diff --git a/.editorconfig b/.editorconfig index 7df89a90eb3..cdaf5b3af2e 100644 --- a/.editorconfig +++ b/.editorconfig @@ -22,3 +22,7 @@ indent_style = tab indent_style = tab [*.md] trim_trailing_whitespace = false +[*.sql] +indent_style = tab +trim_trailing_whitespace = true +indent_size = 4 diff --git a/ChangeLog b/ChangeLog index dc13087832a..bda30ca8caa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -29,9 +29,10 @@ For users: ---------- NEW: Compatibility with PHP 8.2 NEW: Module Workstation (used to enhance the module BOM and Manufacturing Order) is now stable +NEW: Add a CLI tool to regenerate all documents NEW: Add a confirmation popup when deleting extrafields NEW: Add type 'icon' type for extrafields -NEW: Close #20930 Use ajax for state loading after country change +NEW: #20930 Use ajax for state loading after country change NEW: #23331 Add support for parent projects (#24856) NEW: #22531 Expense report - Add two fields into export : Qty & Unit price (excl.) (#26309) NEW: #22626 date filter thirdparties contracts projects (#22707) @@ -42,54 +43,51 @@ NEW: Accountancy: Add quick navigation with keyboard shortcut on ledger (#26221) NEW: Accountancy: FEC/FEC2 format export with attachments (#26192) NEW: Accountancy: Option to choose length of lettering code NEW: Accountancy: Chart of accounts ES PCG08-PYME-CAT in catalan language -NEW: Add a button to create a product or a service from an order or an invoice (#26173) -NEW: Add a button to re-encrypt data of a dolcrypt extrafield password -NEW: Add a CLI tool to regenerate all documents -NEW: Add a goto url from smartphone search page -NEW: Add all id prof checker on thirdparty for code compta customer and supplier -NEW: Add a protection on purgeFiles -NEW: Add chart of accounts PCG08-PYME-CAT for ES in catalan language -NEW: add constant to check if qty shipped not greater than qty ordered -NEW: Add context for the movement stock (role toconsume/toproduce) on mrp -NEW: Add contract link on ticket -NEW: Add culum Technical ID in list of details lines of an order (#26164) -NEW: Add custom compute for exports -NEW: Add custom Text on footer total (#26334) -NEW: Add different picto for each type of extrafields (date, string, ...) -NEW: Added of a popup on validation instead of a database fielld to know if the user wants to include subwarehouse -NEW: Added of the field "include_sub_warehouse" in the table "llx_inventory" -NEW: Added VAT free & VAT amounts on payment input -NEW: Add ext payment system ID in the payment page with link to Stripe -NEW: Add field TechnicalID in list of users -NEW: Add filter on status of line of a dictionary -NEW: Add get_substitutionarray_other() on shipping odt (#25080) -NEW: add IdProfCheck on thirdparty for BE (xxxx.xxx.xxx) -NEW: Add index on prelevement_demande -NEW: Add invoice subtype in customer invoice (#26543) and template invoice (SQL part) (#26535) -NEW: Add label to price level when changing price (#26240) -NEW: Add modifications of template invoices into agenda -NEW: Add more company information (ProfId7 to 10) (#25266) -NEW: Add more information to holiday mailings (#25461) -NEW: Add more param on fetch() to prepare perf optimization -NEW: Add more tables activated by module activation only -NEW: Add new field into $fields array + Creation of the function getChildWarehouse() -NEW: Add option for cancel consumed and produced lines (delete lines and rollback stocks) when delete or cancel an manufacturing order (#26254) -NEW: Add option in PDF for purchase order and quotation to hide prices -NEW: Add option TAKEPOS_HIDE_PRODUCT_PRICES to hide prices in TakePOS -NEW: add order supplier submit notif -NEW: add parent product column on list -NEW: Add picto in product/service list in object lines (#25511) -NEW: Add possibility to choose separator #21426 -NEW: Add preselected update keys attribute to import class and select it by default if filled -NEW: Add recurring behaviour -NEW: add recursive deletion option for child m os (#26102) -NEW: Add refactoring user permission (#26162) -NEW: add sorting of product price list by customer (#26483) -NEW: Add tab Events/Agenda on recurring invoices -NEW: Add the formEditObjectLine hook on commande card and invoice card -NEW: Add the picto phone of thirdparty on the kanban view of projects -NEW: Add the status of partnership to select partnership for emailing -NEW: add Ticket tab on contract +NEW: added a button to create a product or a service from an order or an invoice (#26173) +NEW: added a button to re-encrypt data of a dolcrypt extrafield password +NEW: added a goto url from smartphone search page +NEW: added all id prof checker on thirdparty for code compta customer and supplier +NEW: added protection on purgeFiles +NEW: added a constant to check if qty shipped not greater than qty ordered +NEW: added context for the movement stock (role toconsume/toproduce) on mrp +NEW: added contract link on ticket +NEW: added column 'Technical ID' in list of details lines of an order (#26164) +NEW: added custom compute for exports +NEW: added custom text on footer total (#26334) +NEW: added different picto for each type of extrafields (date, string, ...) +NEW: added a popup on validation instead of a database field to know if the user wants to include subwarehouse +NEW: added the field "include_sub_warehouse" in the table "llx_inventory" +NEW: added VAT free & VAT amounts on payment input +NEW: added ext payment system ID in the payment page with link to Stripe +NEW: added field Technical ID in list of users +NEW: added filter on status of line of a dictionary +NEW: added get_substitutionarray_other() on shipping odt (#25080) +NEW: added IdProfCheck on thirdparty for BE (xxxx.xxx.xxx) +NEW: added index on prelevement_demande +NEW: added invoice subtype in customer invoice (#26543) and template invoice (SQL part) (#26535) +NEW: added a label to price level when changing price (#26240) +NEW: added modifications of template invoices into agenda +NEW: added more company information (ProfId7 to 10) (#25266) +NEW: added more information to holiday mailings (#25461) +NEW: added more param on fetch() to prepare perf optimization +NEW: added more tables activated by module activation only +NEW: added new field into $fields array + Creation of the function getChildWarehouse() +NEW: added option for cancel consumed and produced lines (delete lines and rollback stocks) when delete or cancel an manufacturing order (#26254) +NEW: added option in PDF for purchase order and quotation to hide prices +NEW: added order supplier submit notif +NEW: added parent product column on list +NEW: added picto in product/service list in object lines (#25511) +NEW: added possibility to choose separator #21426 +NEW: added preselected update keys attribute to import class and select it by default if filled +NEW: added recurring behaviour +NEW: added recursive deletion option for child MOs (#26102) +NEW: added refactoring user permission (#26162) +NEW: added sorting of product price list by customer (#26483) +NEW: added tab Events/Agenda on recurring invoices +NEW: added the formEditObjectLine hook on commande card and invoice card +NEW: added the picto phone of thirdparty on the kanban view of projects +NEW: added the status of partnership to select partnership for emailing +NEW: added Ticket tab on contract NEW: Agenda: agenda per user use quarter hour split instead of half hour split NEW: Allow generation of delivery note through REST-API (#26226) NEW: Allow sync of currency rates with currency layer by default. @@ -108,6 +106,7 @@ NEW: clone skill object (#26526) NEW: column in table prelevement_lignes for fk_user (#26196) NEW: CONF allow modify ticket classification even if closed NEW: conf to display date entry stock exped and sort in date order (#22625) +NEW: Contract: Merge the "Create ..." buttons on contract into one. NEW: create a product from a free line in a document (#22324) NEW: customize position in complete_head_from_modules (#26406) NEW: Date d'entree en stock sur les exped au moment de la création -> Stock date on exped at time of creation @@ -118,19 +117,20 @@ NEW: Donations: Generic doc template for donations (#26338) NEW: drop down for action button show a simple button if only 1 action NEW: Enhance github_commits_perversion to get more stats on git commits NEW: Enhance IPN to support payment_intent.succeeded for both card/ban -NEW: Exports: add product barcode on stock exports +NEW: Exports: added product barcode on stock exports NEW: extrafields password accepts 'dolcrypt' algorithm (reversible algo) NEW: Factorize a lot of code for numbering modules NEW: filter on from/to period rather than month/year (#26378) -NEW: FontAwesome - Add possibility to select another version -NEW: Can generate SEPA files for salaries (#26541) +NEW: FontAwesome - added possibility to select another version NEW: Get list evaluation with skills details in user fiche (#26510) NEW: hidden conf to disable use of dns_get_record (which can become unresponsive) (#26339) +NEW: HR: PDF Generation for each Human Resource Evaluations NEW: improved resource data structure -NEW: Intervention: close notification for interventions +NEW: Interventions: close notification for interventions NEW: Inventory: include sub warehouse in inventory NEW: Inventory: inventory without virtual products (kits) NEW: Invoices: subtypes for customers and vendors (#26233) +NEW: Invoices: start and end date for due date filter on invoice list NEW: Invoice time from task, make task note better display in invoice line NEW: lazy load to substitute project variables (#26451) NEW: LDAP: Active Directory UserAccountControl (#25507) @@ -140,7 +140,6 @@ NEW: Manage rate indirect. (#26449) NEW: Manufacturing Order: add edit line on MO (#26122) NEW: memorize model name for PDF hooks NEW: Menu editor is responsive -NEW: Merge the "Create ..." buttons on contract into one. NEW: ModuleBuilder: Can modify the picto into ModuleBuilder NEW: ModuleBuilder: Form for add object's property on ModuleBuilder NEW: More accurate tooltip on what admin permissions are @@ -151,7 +150,7 @@ NEW: no need to create invoice supplier object on supplier card for standalone c NEW: Open-Surveys: Add a public page to list all open surveys NEW: Option to show label, ref+label or only ref of product in TakePOS NEW: payment full amount detail tooltip -NEW: Payment: Can edit both the Test and Live stripe customer account on payment +NEW: Payments: Can edit both the Test and Live stripe customer account on payment NEW: possibility to deselect line when create a recurring invoice + missing to use fk_parent_line NEW: Projects: List - use select2 multiselect for status NEW: Projects: massactions to delete projects @@ -162,11 +161,11 @@ NEW: Retrieve VAT details from the Greek Ministry of Finance GSIS SOAP web servi NEW: Right for stats orders (#24607) NEW: rights and check access to create portal accounts NEW: Row in list higher height (#26177) +NEW: Salaries: Can generate SEPA files for salaries (#26541) NEW: Save date of RUM creation when creating a Stripe SEPA mandate -NEW: Shipment: can include service (for information and invoicing) (#26407) +NEW: Shipments: can include service (for information and invoicing) (#26407) NEW: Show id of module on the tooltip module help page NEW: show VAT free amount on payment input close #26208 (#26209) -NEW: start and end date for due date filter on invoice list NEW: Sub total in list (#26165) NEW: Support html content for combo list of email recipient NEW: TakePOS: add constant to check qty asked is available (#24820) @@ -174,6 +173,7 @@ NEW: TakePOS: add constant to choose contact instead of customer (#24807) NEW: TakePOS: amount label with or without tax in free product (#24829) NEW: TakePOS: compatibility with lots and serials (#26426) NEW: TakePOS: use default customer, category and product when enable TakePOS (#25031) +NEW: TakePOS: added option TAKEPOS_HIDE_PRODUCT_PRICES to hide prices in TakePOS NEW: Tickets: add and list external contributors on ticket public interface NEW: Third-Parties: add total line to third-parties list (#26148) NEW: Tooltips are using ajax by default @@ -187,12 +187,7 @@ NEW: use account address in sepa mandate (#23642) NEW: VAT rate - Add entity NEW: Website: Support of js into the Dolibarr server preview NEW: When an user unset the batch management of products, transformation of each batch stock movement in global stock movement -NEW: PDF Generation for each Human Resource Evaluations. -SEC: #25512 applicative anti bruteforce - security on too many login attempts (#25520) -SEC: Add action confirm_... as sensitive to need a CSRF token -SEC: Disable not used PHP streams -SEC: Add option MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY For developers or integrators: @@ -201,6 +196,12 @@ For developers or integrators: QUAL Reduce very seriously the technical debt (using PHPStan, Psalm and Rector) NEW Tool in dev/tools/rector to autofix code using style coding practice rules +SECURITY +SEC: #25512 applicative anti bruteforce - security on too many login attempts (#25520) +SEC: added action confirm_... as sensitive to need a CSRF token +SEC: Disable not used PHP streams +SEC: added option MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY + PERFORMANCE PERF: Removed a useless fetch_thirdparty PERF: Perf avoid 2 useless fetch into the triggers of agenda. @@ -253,7 +254,7 @@ NEW: add a $notrigger param to Product::updatePrice() method (#26404) NEW: add a rule to fix empty($conf->global->...) into !getDolGlobal... NEW: add column extraparams on societe_rib NEW: add phpunit for REST API of contacts -NEW: add barcode function to check if EAN13 is valid +NEW: add barcode function to check if EAN13 is valid WARNING: @@ -270,7 +271,7 @@ The following changes may create regressions for some external modules, but were * The property ->user_creation to store ID of user of creation has been renamed into ->user_creation_id. * The property ->user_modification to store ID of user of modification has been renamed into ->user_modification_id. * The private array ->status_short, ->statuts and ->status_long are now array ->labelStatusShort and ->labelStatus everywhere. -* The duplicate property ->user_creat, ->date_creat, ->date_valid have been removed (use instead user_creation, date_creation, date_validation). +* The duplicate property ->user_creat, ->date_creat, ->date_valid have been removed (use instead user_creation, date_creation, date_validation). * The method get_substitutionarray_shipment_lines() has been removed. Use the generic get_substitutionarray_lines() instead. * The method ProductcustomerPrice->fetch_all_log() has been renamed into camel case ->fetchAllLog() * It was possible to use a variable $soc or $right inside a PHP code condition of some extrafields properties, this is no more true (this 2 variables are no more global variables). @@ -488,7 +489,7 @@ NEW: Accountancy - Quadratus export with attachments in accountancy export NEW: Accountancy - Can filter on a custom group of accounts. Perf or ledger list. NEW: Accountancy - Can select the export format during export of journals NEW: Accountancy - sort of column of custom group of account -NEW: Can upload a file with drag and drop on purchase invoice, vats, salaries and social contributions +NEW: Can upload a file with drag and drop on purchase invoice, vats, salaries and social contributions NEW: Authentication: #22740 add OpenID Connect impl NEW: Authentication: add experimental support for Google OAuth2 connection NEW: Authentication: can now edit service name for OAuth token @@ -676,14 +677,14 @@ WARNING: Following changes may create regressions for some external modules, but were necessary to make Dolibarr better: * Minimal PHP version is now PHP 7.1 instead of PHP 7.0 -* Sensitive data like keys in setup pages, that need encryption (for example the API keys of users, the CRON security key, the keys into the Stripe module, or +* Sensitive data like keys in setup pages, that need encryption (for example the API keys of users, the CRON security key, the keys into the Stripe module, or external modules setup pages that store sensitive keys or password), are using the $dolibarr_main_instance_unique_id as part of the key for encryption. So, if you restore or duplicate the data from another instance dump, you must also -update this parameter in the conf.php file to allow decryption in the new instance, or +update this parameter in the conf.php file to allow decryption in the new instance, or better, you must reenter the sensitive data into the setup pages of the new instance to resave them correctly. -Note that to find all the parameters that are encrypted into the setup database, you can do a "SELECT * FROM llx_const WHERE value LIKE '%dolcrypt%';" +Note that to find all the parameters that are encrypted into the setup database, you can do a "SELECT * FROM llx_const WHERE value LIKE '%dolcrypt%';" * The deprecated method "escapeunderscore()" of database handlers has been removed. You must use "escapeforlike()" instead. -* The method "nb_expedition()" has been renamed into "countNbOfShipments()" +* The method "nb_expedition()" has been renamed into "countNbOfShipments()" * Revert default type of hooks. Default is now 'addreplace' hooks (and exception become 'output' hooks, that become deprecated). * Deprecated property libelle removed from entrepot class. * The type 'text' in ->fields property does not accept html content anymore. Use the type 'html' for that. @@ -1085,7 +1086,7 @@ WARNING: Following changes may create regressions for some external modules, but were necessary to make Dolibarr better: * Minimal PHP version is now PHP 7.0 instead of PHP 5.6 * Core has introduced a Universal Filter Syntax for search criteria. Example: ((((field1:=:value1) OR (field2:in:1,2,3)) AND ...). In rare case, some filters - could be provided by URL parameters. For such cases (societe/ajax/company.php), use of Universal Filter Syntax become mandatory. + could be provided by URL parameters. For such cases (societe/ajax/company.php), use of Universal Filter Syntax become mandatory. * The signature of method getNomUrl() of class ProductFournisseur has been modified to match the signature of method Product->getNomUrl() * Trigger ORDER_SUPPLIER_DISPATCH is removed, use ORDER_SUPPLIER_RECEIVE and/or LINEORDER_SUPPLIER_DISPATCH instead. * All functions fetch_all() have been set to deprecated for naming consistency, use fetchAll() instead. @@ -1163,7 +1164,7 @@ FIX: #23019 Impossible to add task times to an existing draft invoice FIX: #23072 FIX: #23075 FIX: #23087 -FIX: #23115 +FIX: #23115 FIX: #23116 FIX: #23117 FIX: #23281 @@ -7550,7 +7551,7 @@ FIX: #4583 Incorrect call of Categories::containing throws a DoliDB error FIX: #4649 Wrong parameters order FIX: #4768 FIX: #4785 -FIX: Add a test to show bugged module with a bad declaration of dictionaries to avoid to see clean module to be breaked. +FIX: Add a test to show bugged module with a bad declaration of dictionaries to avoid clean modules to be broken. FIX: add Croatia into list of country in EEC FIX: add missing global def for ttc column FIX: ajax error with multicompany module diff --git a/README.md b/README.md index 1d7ea4b321c..481dee5890c 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ If you have low technical skills and you're looking to install Dolibarr ERP/CRM - [DoliWamp for Windows](https://wiki.dolibarr.org/index.php/Dolibarr_for_Windows_(DoliWamp)) - [DoliDeb for Debian](https://wiki.dolibarr.org/index.php/Dolibarr_for_Ubuntu_or_Debian) -- DoliRpm for Redhat, Fedora, OpenSuse, Mandriva or Mageia +- DoliRpm for Red Hat, Fedora, OpenSuse, Mandriva or Mageia Releases can be downloaded from [official website](https://www.dolibarr.org/). @@ -45,19 +45,19 @@ On GNU/Linux, first check if your distribution has already packaged Dolibarr. #### Generic install steps -- Check that your installed PHP version is supported [see PHP support](https://wiki.dolibarr.org/index.php/Releases). +- Verify that your installed PHP version is supported [see PHP support](https://wiki.dolibarr.org/index.php/Releases). -- Uncompress the downloaded .zip archive to copy the "dolibarr/htdocs" directory and all its files inside your web server root or get the files directly from GitHub (recommended if you know git as it makes it easier if you want to upgrade later): +- Uncompress the downloaded .zip archive to copy the `dolibarr/htdocs` directory and all its files inside your web server root or get the files directly from GitHub (recommended if you know git as it makes it easier if you want to upgrade later): `git clone https://github.com/dolibarr/dolibarr -b x.y` (where x.y is the main version like 3.6, 9.0, ...) -- Set up your web server to use "*dolibarr/htdocs*" as root if your web server does not have an already defined directory to point to. +- Set up your web server to use `dolibarr/htdocs` as root if your web server does not already define a directory to point to. - Create an empty `htdocs/conf/conf.php` file and set *write* permissions for your web server user (*write* permission will be removed once install is finished) - From your browser, go to the dolibarr "install/" page - The URL will depends on how your web setup was set up to point to your dolibarr installation. It may look like: + The URL will depend on how your web configuration directs to your dolibarr installation. It may look like: `http://localhost/dolibarr/htdocs/install/` @@ -71,18 +71,20 @@ On GNU/Linux, first check if your distribution has already packaged Dolibarr. - Follow the installer instructions -### SaaS/Cloud setup +### SaaS/Cloud Setup -If you don't have time to install it yourself, you can try some commercial 'ready to use' Cloud offers (See [https://saas.dolibarr.org](https://saas.dolibarr.org)). However, this third solution is not free. +If you lack the time to install it yourself, consider exploring commercial 'ready-to-use' Cloud offerings (refer to https://saas.dolibarr.org). Keep in mind that this third option comes with associated costs. ## UPGRADING Dolibarr supports upgrading, usually without the need for any (commercial) support (depending on if you use any commercial extensions). It supports upgrading all the way from any version after 2.8 without breakage. This is unique in the ERP ecosystem and a benefit our users highly appreciate! +Follow these step-by-step instructions to seamlessly upgrade Dolibarr to the latest version: + - At first make a backup of your Dolibarr files & then [see](https://wiki.dolibarr.org/index.php/Installation_-_Upgrade#Upgrade_Dolibarr) -- Check that your installed PHP version is supported by the new version [see PHP support](https://wiki.dolibarr.org/index.php/Releases). -- Overwrite all old files from the 'dolibarr' directory with files provided into the new version's package. -- At first next access, Dolibarr will redirect you to the "install/" page to follow the upgrade process. +- Verify that your installed PHP version is supported by the new version [see PHP support](https://wiki.dolibarr.org/index.php/Releases). +- Overwrite all old files from the 'dolibarr' directory with files provided in the new version's package. +- At your next access, Dolibarr will redirect you to the "install/" page to follow the upgrade process.  If an `install.lock` file exists to lock any other upgrade process, the application will ask you to remove the file manually (you should find the `install.lock` file in the directory used to store generated and uploaded documents, in most cases, it is the directory called "*documents*"). ## WHAT'S NEW @@ -114,7 +116,7 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog) - Customer Orders management - Contracts/Subscription management - Interventions management -- Ticket System (+ Knowledge management) +- Ticket System (+ Knowledge management) - Partnership management - Shipping management - Customer Invoices/Credit notes and payment management @@ -123,10 +125,10 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog) Supplier/Purchase Management - Suppliers/Vendors + Contacts -- Supplier (price) requests +- Supplier (pricing) requests - Purchase Orders management - Delivery/Reception -- Supplier Invoices/credit notes and payment management +- Supplier Invoices/Credit notes and payment management - INCOTERMS Finance/Accounting @@ -142,7 +144,7 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog) Collaboration -- Shared calendar/agenda (with ical and vcal import/export for third-party tools integration) +- Shared calendar/agenda (with `ical` and `vcal` import/export for third-party tools integration) - Projects & Tasks management - Event organization - Ticket System @@ -150,7 +152,7 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog) HR - Human Resources Management -- Employee's leaves management +- Employee leave management - Expense reports - Recruitment management - Employee/staff management @@ -178,7 +180,7 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog) - Multi-Language Support (Localization in most major languages) - Multi-users and groups with finely-grained rights - Multi-Currency -- Multi-Company (by adding of an external module) +- Multi-Company (by adding an external module) - Very user-friendly and easy to use - Customizable dashboards - Highly customizable: enable only the modules you need, add user personalized fields, choose your skin, several menu managers (can be used by internal users as a back-office with a particular menu, or by external users as a front-office with another one) @@ -192,7 +194,7 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog) - Argentina invoice numbering using A,B,C... - ZATCA e-invoicing QR-Code - Compatible with [European directives](https://europa.eu/legislation_summaries/taxation/l31057_en.htm) (2006/112/CE ... 2010/45/UE) - - Compatible with data privacy rules (Europe GDPR, ...) + - Compatible with data privacy rules (Europe's GDPR, ...) - ... - Flexible PDF & ODT generation for invoices, proposals, orders... - ... @@ -215,7 +217,7 @@ These are features that Dolibarr does **not** yet fully support: - Tasks dependencies in projects - Payroll module -- No native embedded Webmail, but you can send emails to contacts in Dolibarr with e.g. offers, invoices, etc. +- Native embedded Webmail, but you can send email to contacts in Dolibarr with e.g. offers, invoices, etc. - Dolibarr can't do coffee (yet) ## DOCUMENTATION @@ -225,7 +227,7 @@ Administrator, user, developer and translator's documentation are available alon ## CONTRIBUTING This project exists thanks to all the people who contribute. -Please read the instructions on how to contribute (report a bug/error, a feature request, send code ...) [[Contribute](https://github.com/Dolibarr/dolibarr/blob/develop/.github/CONTRIBUTING.md)] +Please read the instructions on how to contribute (report a bug/error, a feature request, send code, ...) [[Contributing](https://github.com/Dolibarr/dolibarr/blob/develop/.github/CONTRIBUTING.md)] A View on Contributors: diff --git a/dev/tools/rector/README.md b/dev/tools/rector/README.md index c28f7a8d6c5..6ad928af5eb 100644 --- a/dev/tools/rector/README.md +++ b/dev/tools/rector/README.md @@ -18,11 +18,13 @@ composer install ##### To make changes (Add --dry-run for test mode only) ```shell +cd dev/tools/rector ./vendor/bin/rector process --dry-run ``` ##### To make changes on a given directory ```shell +cd dev/tools/rector ./vendor/bin/rector process [--dry-run] [--clear-cache] ../../../htdocs/core/ ``` diff --git a/dev/tools/rector/rector.php b/dev/tools/rector/rector.php index 5b07d1da6cc..dceb00bfb4b 100644 --- a/dev/tools/rector/rector.php +++ b/dev/tools/rector/rector.php @@ -49,12 +49,13 @@ return static function (RectorConfig $rectorConfig): void { $rectorConfig->rule(Rector\CodeQuality\Rector\FuncCall\FloatvalToTypeCastRector::class); $rectorConfig->rule(Rector\CodeQuality\Rector\FuncCall\BoolvalToTypeCastRector::class); $rectorConfig->rule(Rector\CodeQuality\Rector\NotEqual\CommonNotEqualRector::class); - //$rectorconfig->rule(Rector\CodeQuality\Rector\If_\CompleteMissingIfElseBracketRector::class); + //Not yet ready: $rectorconfig->rule(Rector\CodeQuality\Rector\If_\CompleteMissingIfElseBracketRector::class); $rectorConfig->rule(Rector\CodeQuality\Rector\For_\ForRepeatedCountToOwnVariableRector::class); + $rectorConfig->rule(Dolibarr\Rector\Renaming\EmptyGlobalToFunction::class); + $rectorConfig->rule(Dolibarr\Rector\Renaming\EmptyUserRightsToFunction::class); $rectorConfig->rule(Dolibarr\Rector\Renaming\GlobalToFunction::class); $rectorConfig->rule(Dolibarr\Rector\Renaming\UserRightsToFunction::class); - $rectorConfig->rule(Dolibarr\Rector\Renaming\EmptyGlobalToFunction::class); // Add all predefined rules to migrate to up to php 71. // Warning this break tab spacing of arrays on several lines diff --git a/dev/tools/rector/src/Renaming/EmptyGlobalToFunction.php b/dev/tools/rector/src/Renaming/EmptyGlobalToFunction.php index 0bd1575adcd..36260563908 100644 --- a/dev/tools/rector/src/Renaming/EmptyGlobalToFunction.php +++ b/dev/tools/rector/src/Renaming/EmptyGlobalToFunction.php @@ -52,10 +52,10 @@ class EmptyGlobalToFunction extends AbstractRector public function getRuleDefinition(): RuleDefinition { return new RuleDefinition( - 'Change $conf->global to getDolGlobal', + 'Change empty($conf->global->...) to getDolGlobal', [new CodeSample( - '$conf->global->CONSTANT', - 'getDolGlobalInt(\'CONSTANT\')' + 'empty($conf->global->CONSTANT)', + '!getDolGlobalInt(\'CONSTANT\')' )] ); } @@ -82,10 +82,10 @@ class EmptyGlobalToFunction extends AbstractRector if (!$node->expr instanceof Node\Expr\Empty_) { return null; } - // node is !empty(...) so we set node to ... - $newnode = $node->expr->expr; + // node is !empty(...) so we set newnode to ... + $newnode = $node->expr->expr; // newnode is conf->global->... - $tmpglobal = $newnode->var; + $tmpglobal = $newnode->var; // tmpglobal is global->... if (is_null($tmpglobal)) { return null; } @@ -93,7 +93,7 @@ class EmptyGlobalToFunction extends AbstractRector return null; } - $tmpconf = $tmpglobal->var; + $tmpconf = $tmpglobal->var; // tmpconf is conf-> if (!$this->isName($tmpconf, 'conf')) { return null; } @@ -113,10 +113,10 @@ class EmptyGlobalToFunction extends AbstractRector if ($node instanceof Node\Expr\Empty_) { - // node is empty(...) so we set node to ... - $newnode = $node->expr; + // node is empty(...) so we set newnode to ... + $newnode = $node->expr; // newnode is conf->global->... - $tmpglobal = $newnode->var; + $tmpglobal = $newnode->var; // tmpglobal is global->... if (is_null($tmpglobal)) { return null; } @@ -124,7 +124,7 @@ class EmptyGlobalToFunction extends AbstractRector return null; } - $tmpconf = $tmpglobal->var; + $tmpconf = $tmpglobal->var; // tmpconf is conf-> if (!$this->isName($tmpconf, 'conf')) { return null; } diff --git a/dev/tools/rector/src/Renaming/EmptyUserRightsToFunction.php b/dev/tools/rector/src/Renaming/EmptyUserRightsToFunction.php new file mode 100644 index 00000000000..a1b4f2f56de --- /dev/null +++ b/dev/tools/rector/src/Renaming/EmptyUserRightsToFunction.php @@ -0,0 +1,283 @@ +binaryOpManipulator = $binaryOpManipulator; + } + + /** + * getRuleDefinition + * + * @return RuleDefinition + * @throws PoorDocumentationException + */ + public function getRuleDefinition(): RuleDefinition + { + return new RuleDefinition( + 'Change empty(\$user->rights->module->permission) to !\$user->hasRight(\'module\', \'permission\')', + [new CodeSample( + 'empty($user->rights->module->permission)', + '!$user->hasRight(\'module\', \'permission\')' + )] + ); + } + + /** + * Return a node type from https://github.com/rectorphp/php-parser-nodes-docs/ + * + * @return string[] + */ + public function getNodeTypes(): array + { + return [Node\Expr\BooleanNot::class, Node\Expr\Empty_::class]; + } + + /** + * refactor + * + * @param Node $node A node + * @return FuncCall|BooleanNot + */ + public function refactor(Node $node) + { + if ($node instanceof Node\Expr\BooleanNot) { + if (!$node->expr instanceof Node\Expr\Empty_) { + return null; + } + // node is !empty(...) so we set newnode to ... + $newnode = $node->expr->expr; + + $tmpperm = $newnode->var; //name of tmpperm is modulex + if (is_null($tmpperm)) { + return null; + } + + $tmprights = $tmpperm->var; // name of tmprights is 'rights' + if (is_null($tmprights)) { + return null; + } + if (!$this->isName($tmprights, 'rights')) { + $tmprights2 = $tmprights->var; // name of tmprights is 'rights' + if (is_null($tmprights2)) { + return null; + } + if (!$this->isName($tmprights2, 'rights')) { + return null; + } + $tmprights = $tmprights2; + } + + $tmpuser = $tmprights->var; // name of tmpuser is 'user' + if (!$this->isName($tmpuser, 'user')) { + return null; + } + + $data = $this->getRights($newnode); + if (!isset($data)) { + return; + } + + $args = [new Arg($data['module']), new Arg($data['perm1'])]; + if (!empty($data['perm2'])) { + $args[] = new Arg($data['perm2']); + } + $method = $this->nodeFactory->createMethodCall($data['user'], 'hasRight', $args); + + return $method; + } + + if ($node instanceof Node\Expr\Empty_) { + // node is empty(...) so we set newnode to ... + $newnode = $node->expr; // name of node is perm + + $tmpperm = $newnode->var; //name of tmpperm is modulex + if (is_null($tmpperm)) { + return null; + } + + $tmprights = $tmpperm->var; // name of tmprights is 'rights' + if (is_null($tmprights)) { + return null; + } + if (!$this->isName($tmprights, 'rights')) { + $tmprights2 = $tmprights->var; // name of tmprights is 'rights' + if (is_null($tmprights2)) { + return null; + } + if (!$this->isName($tmprights2, 'rights')) { + return null; + } + $tmprights = $tmprights2; + } + + $tmpuser = $tmprights->var; // name of tmpuser is 'user' + if (!$this->isName($tmpuser, 'user')) { + return null; + } + + $data = $this->getRights($newnode); + if (!isset($data)) { + return; + } + + $args = [new Arg($data['module']), new Arg($data['perm1'])]; + if (!empty($data['perm2'])) { + $args[] = new Arg($data['perm2']); + } + $method = $this->nodeFactory->createMethodCall($data['user'], 'hasRight', $args); + + return new Node\Expr\BooleanNot($method); + } + + return null; + } + + /** + * Get nodes with check empty + * + * @param BooleanAnd $booleanAnd A BooleandAnd + * @return TwoNodeMatch|null + */ + private function resolveTwoNodeMatch(BooleanAnd $booleanAnd): ?TwoNodeMatch + { + return $this->binaryOpManipulator->matchFirstAndSecondConditionNode( + $booleanAnd, + // $conf->global == $value + function (Node $node): bool { + if (!$node instanceof Equal) { + return \false; + } + return $this->isGlobalVar($node->left); + }, + // !empty(...) || isset(...) + function (Node $node): bool { + if ($node instanceof BooleanNot && $node->expr instanceof Empty_) { + return $this->isGlobalVar($node->expr->expr); + } + if (!$node instanceof Isset_) { + return $this->isGlobalVar($node); + } + return \true; + } + ); + } + + /** + * Check if node is a global access with format conf->global->XXX + * + * @param Node $node A node + * @return bool Return true if noe is conf->global->XXX + */ + private function isGlobalVar($node) + { + if (!$node instanceof PropertyFetch) { + return false; + } + if (!$this->isName($node->var, 'global')) { + return false; + } + $global = $node->var; + if (!$global instanceof PropertyFetch) { + return false; + } + if (!$this->isName($global->var, 'conf')) { + return false; + } + return true; + } + + /** + * @param Node $node Node to be parsed + * @return Node|void Return the name of the constant + */ + private function getConstName($node) + { + if ($node instanceof PropertyFetch && $node->name instanceof Node\Expr) { + return $node->name; + } + $name = $this->getName($node); + if (empty($name)) { + return; + } + return new String_($name); + } + + /** + * @param \PhpParser\Node\Expr\PropertyFetch $node node + * @return array|null + */ + private function getRights(Node\Expr\PropertyFetch $node) + { + $perm2 = ''; + if (!$node->var instanceof Node\Expr\PropertyFetch) { + return null; + } + // Add a test to avoid rector error on html.formsetup.class.php + if (!$node->name instanceof Node\Expr\Variable && is_null($this->getName($node))) { + //var_dump($node); + return null; + //exit; + } + $perm1 = $node->name instanceof Node\Expr\Variable ? $node->name : new String_($this->getName($node)); + $moduleNode = $node->var; + if (!$moduleNode instanceof Node\Expr\PropertyFetch) { + return null; + } + if (!$moduleNode->var instanceof Node\Expr\PropertyFetch) { + return null; + } + if (!$this->isName($moduleNode->var, 'rights')) { + $perm2 = $perm1; + $perm1 = $moduleNode->name instanceof Node\Expr\Variable ? $moduleNode->name : new String_($this->getName($moduleNode)); + $moduleNode = $moduleNode->var; + } + $module = $moduleNode->name instanceof Node\Expr\Variable ? $moduleNode->name : new String_($this->getName($moduleNode)); + $rights = $moduleNode->var; + if (!$this->isName($rights, 'rights') || !isset($perm1) || !isset($module)) { + return null; + } + if (!$rights->var instanceof Node\Expr\Variable) { + return null; + } + $user = $rights->var; + return compact('user', 'module', 'perm1', 'perm2'); + } +} diff --git a/dev/tools/rector/src/Renaming/GlobalToFunction.php b/dev/tools/rector/src/Renaming/GlobalToFunction.php index fd1a3d7dd66..302a2ff4a2a 100644 --- a/dev/tools/rector/src/Renaming/GlobalToFunction.php +++ b/dev/tools/rector/src/Renaming/GlobalToFunction.php @@ -88,6 +88,7 @@ class GlobalToFunction extends AbstractRector public function refactor(Node $node) { if ($node instanceof Node\Expr\Assign) { + // var is left of = and expr is right if (!isset($node->var)) { return; } diff --git a/dev/tools/rector/src/Renaming/UserRightsToFunction.php b/dev/tools/rector/src/Renaming/UserRightsToFunction.php index 5a141ddad5b..b655e3b82a8 100644 --- a/dev/tools/rector/src/Renaming/UserRightsToFunction.php +++ b/dev/tools/rector/src/Renaming/UserRightsToFunction.php @@ -10,6 +10,10 @@ use Rector\Core\PhpParser\Node\NodeFactory; use Rector\Core\Rector\AbstractRector; use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample; use Symplify\RuleDocGenerator\ValueObject\RuleDefinition; +use PhpParser\Node\Expr\BinaryOp\BooleanAnd; +use PhpParser\Node\Expr\BinaryOp\Concat; +use PhpParser\Node\Expr\BinaryOp\Equal; + /** * Class to refactor User rights @@ -50,6 +54,7 @@ class UserRightsToFunction extends AbstractRector Node\Expr\Assign::class, Node\Expr\PropertyFetch::class, Node\Expr\BooleanNot::class, + Node\Expr\BinaryOp\BooleanAnd::class, Node\Expr\Empty_::class, Node\Expr\Isset_::class, Node\Stmt\ClassMethod::class @@ -74,40 +79,112 @@ class UserRightsToFunction extends AbstractRector } } } + if ($node instanceof Node\Expr\Assign) { - return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN; + // var is left of = and expr is right of = + if (!isset($node->var)) { + return; + } + + if (!$node->expr instanceof Node\Expr\PropertyFetch) { + return; + } + + $data = $this->getRights($node->expr); + if (!isset($data)) { + return; + } + $args = [new Arg($data['module']), new Arg($data['perm1'])]; + if (!empty($data['perm2'])) { + $args[] = new Arg($data['perm2']); + } + $node->expr = $this->nodeFactory->createMethodCall($data['user'], 'hasRight', $args); + + return $node; } + + if ($node instanceof Node\Expr\BinaryOp\BooleanAnd) { + /*$nodes = $this->resolveTwoNodeMatch($node); + if (!isset($nodes)) { + return; + } + + $node = $nodes->getFirstExpr(); + */ + $mustprocesstheleft = false; + $mustprocesstheright = false; + + if ($node->left instanceof Node\Expr\PropertyFetch) { + $data = $this->getRights($node->left); + if (isset($data)) { + $mustprocesstheleft = true; + } + } + if (empty($mustprocesstheleft) && $node->right instanceof Node\Expr\PropertyFetch) { + $data = $this->getRights($node->right); + if (isset($data)) { + $mustprocesstheright = true; + } + } + + if (isset($data)) { + $args = [new Arg($data['module']), new Arg($data['perm1'])]; + if (!empty($data['perm2'])) { + $args[] = new Arg($data['perm2']); + } + + if ($mustprocesstheleft && !empty($data['module'])) { + $node->left = $this->nodeFactory->createMethodCall($data['user'], 'hasRight', $args); + } + if ($mustprocesstheright && !empty($data['module'])) { + $node->right = $this->nodeFactory->createMethodCall($data['user'], 'hasRight', $args); + } + } + + return $node; + } + + $caseok = false; // Will be true if we can make the replacement. We must not do it for assignment like when $user->right->aaa->bbb = ... + $isInverse = false; if ($node instanceof Node\Expr\BooleanNot) { if (!$node->expr instanceof Node\Expr\Empty_) { return null; } $node = $node->expr->expr; + $caseok = true; } if ($node instanceof Node\Expr\Empty_) { $node = $node->expr; $isInverse = true; + $caseok = true; } if ($node instanceof Node\Expr\Isset_) { // Take first arg for isset (No code found with multiple isset). $node = $node->vars[0]; + $caseok = true; } if (!$node instanceof Node\Expr\PropertyFetch) { - return; + return null; } - $data = $this->getRights($node); - if (!isset($data)) { - return; + + if ($caseok) { + $data = $this->getRights($node); + if (!isset($data)) { + return; + } + $args = [new Arg($data['module']), new Arg($data['perm1'])]; + if (!empty($data['perm2'])) { + $args[] = new Arg($data['perm2']); + } + $method = $this->nodeFactory->createMethodCall($data['user'], 'hasRight', $args); + if ($isInverse) { + return new Node\Expr\BooleanNot($method); + } + return $method; + } else { + return null; } - $args = [new Arg($data['module']), new Arg($data['perm1'])]; - if (!empty($data['perm2'])) { - $args[] = new Arg($data['perm2']); - } - $method = $this->nodeFactory->createMethodCall($data['user'], 'hasRight', $args); - if ($isInverse) { - return new Node\Expr\BooleanNot($method); - } - return $method; } /** @@ -150,4 +227,34 @@ class UserRightsToFunction extends AbstractRector $user = $rights->var; return compact('user', 'module', 'perm1', 'perm2'); } + + /** + * Get nodes with check empty + * + * @param BooleanAnd $booleanAnd A BooleandAnd + * @return TwoNodeMatch|null + */ + private function resolveTwoNodeMatch(BooleanAnd $booleanAnd): ?TwoNodeMatch + { + return $this->binaryOpManipulator->matchFirstAndSecondConditionNode( + $booleanAnd, + // Function to check if we are in the case $conf->global->... == $value + function (Node $node): bool { + if (!$node instanceof Equal) { + return \false; + } + return $this->isGlobalVar($node->left); + }, + // !empty(...) || isset(...) + function (Node $node): bool { + if ($node instanceof BooleanNot && $node->expr instanceof Empty_) { + return $this->isGlobalVar($node->expr->expr); + } + if (!$node instanceof Isset_) { + return $this->isGlobalVar($node); + } + return \true; + } + ); + } } diff --git a/htdocs/.gitignore b/htdocs/.gitignore index 0749df8a2bb..d0fe62f2e73 100644 --- a/htdocs/.gitignore +++ b/htdocs/.gitignore @@ -1,3 +1,4 @@ +/aaa* /allscreens* /ancot* /bootstrap* diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php index 636026e526c..ea93f6751fa 100644 --- a/htdocs/accountancy/admin/index.php +++ b/htdocs/accountancy/admin/index.php @@ -374,7 +374,7 @@ if (getDolGlobalInt('ACCOUNTING_MANAGE_ZERO')) { } print ''; -// Param a user $user->rights->accounting->chartofaccount can access +// Param a user $user->hasRights('accounting', 'chartofaccount') can access foreach ($list as $key) { print ''; @@ -404,7 +404,7 @@ print ''; print ''.$langs->trans('BindingOptions').''; print "\n"; -// Param a user $user->rights->accounting->chartofaccount can access +// Param a user $user->hasRights('accounting', 'chartofaccount') can access foreach ($list_binding as $key) { print ''; diff --git a/htdocs/accountancy/class/api_accountancy.class.php b/htdocs/accountancy/class/api_accountancy.class.php index 8e6649b6e4b..652abb731de 100644 --- a/htdocs/accountancy/class/api_accountancy.class.php +++ b/htdocs/accountancy/class/api_accountancy.class.php @@ -92,7 +92,7 @@ class Accountancy extends DolibarrApi global $conf, $langs; // check rights - if (!DolibarrApiAccess::$user->rights->accounting->mouvements->export) { + if (!DolibarrApiAccess::$user->hasRight('accounting', 'mouvements', 'export')) { throw new RestException(401, 'No permission to export accounting'); } diff --git a/htdocs/adherents/class/adherentstats.class.php b/htdocs/adherents/class/adherentstats.class.php index 0416a03de81..f99b20f86d5 100644 --- a/htdocs/adherents/class/adherentstats.class.php +++ b/htdocs/adherents/class/adherentstats.class.php @@ -69,7 +69,6 @@ class AdherentStats extends Stats $this->where .= " m.statut != -1"; $this->where .= " AND p.fk_adherent = m.rowid AND m.entity IN (".getEntity('adherent').")"; - //if (empty($user->rights->societe->client->voir) && !$user->socid) $this->where .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .((int) $user->id); if ($this->memberid) { $this->where .= " AND m.rowid = ".((int) $this->memberid); } diff --git a/htdocs/adherents/class/subscription.class.php b/htdocs/adherents/class/subscription.class.php index 0b3618b4e32..99101b2c07b 100644 --- a/htdocs/adherents/class/subscription.class.php +++ b/htdocs/adherents/class/subscription.class.php @@ -43,7 +43,7 @@ class Subscription extends CommonObject public $table_element = 'subscription'; /** - * @var int Does myobject support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by fk_soc, 'field@table'=Test with link by field@table + * @var string Does myobject support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by fk_soc, 'field@table'=Test with link by field@table */ public $ismultientitymanaged = 'fk_adherent@adherent'; diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index 2114f6107c0..1eda77b6587 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -335,6 +335,38 @@ if (empty($reshook)) { } } + // Create external user + if ($action == 'createsubscription_confirm' && $confirm == "yes" && $user->hasRight('adherent', 'creer')) { + $tmpmember = new Adherent($db); + $adht = new AdherentType($db); + $error = 0; + $nbcreated = 0; + $now = dol_now(); + $amount = price2num(GETPOST('amount', 'alpha')); + $db->begin(); + foreach ($toselect as $id) { + $res = $tmpmember->fetch($id); + if ($res > 0) { + $result = $tmpmember->subscription($now, $amount); + if ($result < 0) { + $error++; + } else { + $nbcreated++; + } + } else { + $error++; + } + } + + if (!$error) { + setEventMessages($langs->trans("XSubsriptionCreated", $nbcreated), null, 'mesgs'); + $db->commit(); + } else { + setEventMessages($langs->trans("XSubsriptionError", $error), null, 'mesgs'); + $db->rollback(); + } + } + // Mass actions $objectclass = 'Adherent'; $objectlabel = 'Members'; @@ -706,6 +738,9 @@ if (isModEnabled('category') && $user->hasRight('adherent', 'creer')) { if ($user->hasRight('adherent', 'creer') && $user->hasRight('user', 'user', 'creer')) { $arrayofmassactions['createexternaluser'] = img_picto('', 'user', 'class="pictofixedwidth"').$langs->trans("CreateExternalUser"); } +if ($user->hasRight('adherent', 'creer')) { + $arrayofmassactions['createsubscription'] = img_picto('', 'payment', 'class="pictofixedwidth"').$langs->trans("CreateSubscription"); +} if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete', 'preaffecttag'))) { $arrayofmassactions = array(); } @@ -740,6 +775,34 @@ $topicmail = "Information"; $modelmail = "member"; $objecttmp = new Adherent($db); $trackid = 'mem'.$object->id; +if ($massaction == 'createsubscription') { + $tmpmember = new Adherent($db); + $adht = new AdherentType($db); + $amount = 0; + foreach ($toselect as $id) { + $now = dol_now(); + $tmpmember->fetch($id); + $res = $adht->fetch($tmpmember->typeid); + if ($res > 0) { + $amounttmp = $adht->amount; + if (!empty($tmpmember->last_subscription_amount) && !GETPOSTISSET('newamount') && is_numeric($amounttmp)) { + $amounttmp = max($tmpmember->last_subscription_amount, $amount); + } + $amount = max(0, $amounttmp, $amount); + } else { + $error++; + } + } + + $date = dol_print_date(dol_now(), "%d/%m/%Y"); + $formquestion = array( + array('label' => $langs->trans("DateSubscription"), 'type' => 'other', 'value' => $date), + array('label' => $langs->trans("Amount"), 'type' => 'text', 'value' => price($amount, 0, '', 0), 'name' => 'amount'), + array('type' => 'separator'), + array('label' => $langs->trans("MoreActions"), 'type' => 'other', 'value' => $langs->trans("None").' '.img_warning($langs->trans("WarningNoComplementaryActionDone"))), + ); + print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassSubsriptionCreation"), $langs->trans("ConfirmMassSubsriptionCreationQuestion", count($toselect)), "createsubscription_confirm", $formquestion, '', 0, 200, 500, 1); +} include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($search_all) { diff --git a/htdocs/admin/emailcollector_list.php b/htdocs/admin/emailcollector_list.php index 84da0f49c03..833e822c288 100644 --- a/htdocs/admin/emailcollector_list.php +++ b/htdocs/admin/emailcollector_list.php @@ -133,9 +133,6 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); -/*$permissiontoread = $user->rights->emailcollector->read; -$permissiontoadd = $user->rights->emailcollector->write; -$permissiontodelete = $user->rights->emailcollector->delete;*/ $permissiontoread = $user->admin; $permissiontoadd = $user->admin; $permissiontodelete = $user->admin; diff --git a/htdocs/admin/fckeditor.php b/htdocs/admin/fckeditor.php index 92a235fc178..71105f078b5 100644 --- a/htdocs/admin/fckeditor.php +++ b/htdocs/admin/fckeditor.php @@ -126,16 +126,19 @@ if (GETPOST('save', 'alpha')) { $error++; } } else { - $error++; + $error = -1; // -1 means a warning message } - if (!$error) { + if ($error == 0) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } elseif ($error == -1) { + setEventMessages($langs->trans("EmptyMessageNotAllowedError"), null, 'warnings'); } else { setEventMessages($langs->trans("Error").' '.$db->lasterror(), null, 'errors'); } } + /* * View */ diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index 51c35a615be..13545002911 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -1061,7 +1061,7 @@ if ($num) { $obj = $db->fetch_object($resql); if ($obj) { - if ($action == 'edit' && ($rowid == (!empty($obj->rowid) ? $obj->rowid : $obj->code))) { + if (($action == 'edit' || $action == 'preview') && ($rowid == (!empty($obj->rowid) ? $obj->rowid : $obj->code))) { print ''; $tmpaction = 'edit'; @@ -1075,21 +1075,25 @@ if ($num) { print ''; print ''; print ''; - print ''; + if ($action == 'edit') { + print ''; + } print '
'; print ''; print ''; } // Show main fields if (empty($reshook)) { - fieldList($fieldlist, $obj, $tabname[$id], 'edit'); + fieldList($fieldlist, $obj, $tabname[$id], $action); } // Action column if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; print ''; print ''; - print ''; + if ($action == 'edit') { + print ''; + } print '
'; print ''; print ''; @@ -1113,18 +1117,18 @@ if ($num) { if ($showfield) { // Show line for topic, joinfiles and content if ($tmpfieldlist == 'topic') { - print ''.$form->textwithpicto($langs->trans("Topic"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).' '; - print ''; + print '
'.$form->textwithpicto($langs->trans("Topic"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'
'; + print ''; print '
'."\n"; } if ($tmpfieldlist == 'email_from') { - print ''.$form->textwithpicto($langs->trans("MailFrom"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).' '; - print ''; + print '
'.$form->textwithpicto($langs->trans("MailFrom"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'
'; + print ''; print '
'."\n"; } if ($tmpfieldlist == 'joinfiles') { - print ''.$form->textwithpicto($langs->trans("FilesAttachedToEmail"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).' '; - print $form->selectyesno($tmpfieldlist.'-'.$rowid, (isset($obj->$tmpfieldlist) ? $obj->$tmpfieldlist : '0'), 1, false, 0, 1); + print '
'.$form->textwithpicto($langs->trans("FilesAttachedToEmail"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'
'; + print $form->selectyesno($tmpfieldlist.'-'.$rowid, (isset($obj->$tmpfieldlist) ? $obj->$tmpfieldlist : '0'), 1, ($action != 'edit'), 0, 1); print '
'."\n"; } @@ -1134,7 +1138,7 @@ if ($num) { if (!getDolGlobalString('FCKEDITOR_ENABLE_MAIL')) { $okforextended = false; } - $doleditor = new DolEditor($tmpfieldlist.'-'.$rowid, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 500, 'dolibarr_mailings', 'In', 0, $acceptlocallinktomedia, $okforextended, ROWS_6, '90%'); + $doleditor = new DolEditor($tmpfieldlist.'-'.$rowid, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 500, 'dolibarr_mailings', 'In', 0, $acceptlocallinktomedia, $okforextended, ROWS_6, '90%', ($action != 'edit' ? 1 : 0)); print $doleditor->Create(1); } if ($tmpfieldlist == 'content_lines') { @@ -1201,6 +1205,8 @@ if ($num) { print ''; if ($canbemodified) { print ''.img_edit().''; + } else { + print ''.img_view().''; } if ($iserasable) { print ''.img_delete().''; @@ -1351,7 +1357,7 @@ $db->close(); * @param array $fieldlist Array of fields * @param Object $obj If we show a particular record, obj is filled with record fields * @param string $tabname Name of SQL table - * @param string $context 'add'=Output field for the "add form", 'edit'=Output field for the "edit form", 'hide'=Output field for the "add form" but we don't want it to be rendered + * @param string $context 'add'=Output field for the "add form", 'edit'=Output field for the "edit form", 'preview'=show in readonly the template, 'hide'=Output field for the "add form" but we don't want it to be rendered * @return void */ function fieldList($fieldlist, $obj = null, $tabname = '', $context = '') @@ -1368,7 +1374,7 @@ function fieldList($fieldlist, $obj = null, $tabname = '', $context = '') print ''; } elseif ($value == 'fk_user') { print ''; - if ($user->admin) { + if ($user->admin && $context != 'preview') { print $form->select_dolusers(empty($obj->$value) ? '' : $obj->$value, 'fk_user', 1, null, 0, ($user->admin ? '' : 'hierarchyme'), null, 0, 0, 0, '', 0, '', 'minwidth75 maxwidth100'); } else { if ($context == 'add') { // I am not admin and we show the add form @@ -1390,7 +1396,7 @@ function fieldList($fieldlist, $obj = null, $tabname = '', $context = '') print ''; } elseif ($value == 'lang') { print ''; - if (getDolGlobalInt('MAIN_MULTILANGS')) { + if (getDolGlobalInt('MAIN_MULTILANGS') && $context != 'preview') { $selectedlang = GETPOSTISSET('langcode') ? GETPOST('langcode', 'aZ09') : $langs->defaultlang; if ($context == 'edit') { $selectedlang = $obj->lang; @@ -1410,7 +1416,7 @@ function fieldList($fieldlist, $obj = null, $tabname = '', $context = '') } elseif ($value == 'type_template') { // Le type de template print ''; - if ($context == 'edit' && !empty($obj->type_template) && !in_array($obj->type_template, array_keys($elementList))) { + if (($context == 'edit' && !empty($obj->type_template) && !in_array($obj->type_template, array_keys($elementList))) || $context == 'preview') { // Current template type is an unknown type, so we must keep it as it is. print ''; print $obj->type_template; @@ -1422,6 +1428,8 @@ function fieldList($fieldlist, $obj = null, $tabname = '', $context = '') //print ''; } elseif ($context == 'edit' && in_array($value, array('topic', 'joinfiles', 'content', 'content_lines'))) { print ''; + } elseif ($context == 'preview' && in_array($value, array('topic', 'joinfiles', 'content', 'content_lines'))) { + print ''; } elseif ($context == 'hide' && in_array($value, array('topic', 'joinfiles', 'content', 'content_lines'))) { //print ''; } else { @@ -1451,14 +1459,14 @@ function fieldList($fieldlist, $obj = null, $tabname = '', $context = '') } print ''; - if ($value == 'private') { + if ($value == 'private' && $context != 'preview') { if (empty($user->admin)) { print $form->selectyesno($value, '1', 1); } else { print $form->selectyesno($value, (isset($obj->$value) ? $obj->$value : ''), 1); } } else { - print ''; + print ''; } print ''; } diff --git a/htdocs/admin/perms.php b/htdocs/admin/perms.php index c89c7ad914c..e7c4bd3fbb4 100644 --- a/htdocs/admin/perms.php +++ b/htdocs/admin/perms.php @@ -262,7 +262,7 @@ if ($result) { if ($user->admin) { print ''; $htmltext = $langs->trans("ID").': '.$obj->id; - $htmltext .= '
'.$langs->trans("Permission").': user->rights->'.$obj->module.'->'.$obj->perms.($obj->subperms ? '->'.$obj->subperms : ''); + $htmltext .= '
'.$langs->trans("Permission").': user->hasRight(\''.$obj->module.'\', \''.$obj->perms.'\''.($obj->subperms ? ', \''.$obj->subperms.'\'' : '').')'; print $form->textwithpicto('', $htmltext); //print ''.$obj->id.''; print ''; diff --git a/htdocs/admin/stock.php b/htdocs/admin/stock.php index ef54a661a32..c7d563058b9 100644 --- a/htdocs/admin/stock.php +++ b/htdocs/admin/stock.php @@ -33,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; // Load translation files required by the page $langs->loadLangs(array("admin", "stocks")); -// Securit check +// Security check if (!$user->admin) { accessforbidden(); } diff --git a/htdocs/admin/system/database-tables.php b/htdocs/admin/system/database-tables.php index d368e14d6e5..e122150571b 100644 --- a/htdocs/admin/system/database-tables.php +++ b/htdocs/admin/system/database-tables.php @@ -195,7 +195,7 @@ if (!$base) { print "\n"; $sql = "SELECT relname, seq_tup_read, idx_tup_fetch, n_tup_ins, n_tup_upd, n_tup_del"; - $sql .= " FROM pg_stat_user_tables"; + $sql .= " FROM pg_stat_user_tables ORDER BY relname"; $resql = $db->query($sql); if ($resql) { diff --git a/htdocs/admin/system/dbtable.php b/htdocs/admin/system/dbtable.php index c061294b9cd..c7e7c5baa5e 100644 --- a/htdocs/admin/system/dbtable.php +++ b/htdocs/admin/system/dbtable.php @@ -85,19 +85,20 @@ if (!$base) { } } - // var_dump($link); - print ''; print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; print ''; print ''; - //$sql = "DESCRIBE ".$table; + // $sql = "DESCRIBE ".$table; $sql = "SHOW FULL COLUMNS IN ".$db->escape($table); $resql = $db->query($sql); @@ -106,15 +107,23 @@ if (!$base) { $i = 0; while ($i < $num) { $row = $db->fetch_row($resql); - //var_dump($row); print ''; + // field print ""; + // type print ""; + // collation + print ""; + // null print ""; + // key print ""; + // default print ""; + // extra print ""; + // privileges print ""; print "'; diff --git a/htdocs/bookcal/availabilities_document.php b/htdocs/bookcal/availabilities_document.php index 94e8fd47384..723df675ef5 100644 --- a/htdocs/bookcal/availabilities_document.php +++ b/htdocs/bookcal/availabilities_document.php @@ -196,10 +196,6 @@ if ($object->id) { print dol_get_fiche_end(); $modulepart = 'bookcal'; - //$permissiontoadd = $user->hasRight('bookcal', 'availabilities', 'write'); - $permissiontoadd = 1; - //$permtoedit = $user->hasRight('bookcal', 'availabilities', 'write'); - $permtoedit = 1; $param = '&id='.$object->id; //$relativepathwithnofile='availabilities/' . dol_sanitizeFileName($object->id).'/'; diff --git a/htdocs/bookcal/bookcalindex.php b/htdocs/bookcal/bookcalindex.php index d2cb7c30a10..cbffda374fd 100644 --- a/htdocs/bookcal/bookcalindex.php +++ b/htdocs/bookcal/bookcalindex.php @@ -35,7 +35,7 @@ $action = GETPOST('action', 'aZ09'); // Security check -// if (! $user->rights->bookcal->myobject->read) { +// if (! $user->hasRight('bookcal', 'myobject', 'read')) { // accessforbidden(); // } $socid = GETPOST('socid', 'int'); diff --git a/htdocs/bookcal/calendar_agenda.php b/htdocs/bookcal/calendar_agenda.php index e882d054f45..deb1f993471 100644 --- a/htdocs/bookcal/calendar_agenda.php +++ b/htdocs/bookcal/calendar_agenda.php @@ -88,8 +88,8 @@ if ($id > 0 || !empty($ref)) { // Set $enablepermissioncheck to 1 to enable a minimum low level of checks $enablepermissioncheck = 0; if ($enablepermissioncheck) { - $permissiontoread = $user->rights->bookcal->calendar->read; - $permissiontoadd = $user->rights->bookcal->calendar->write; + $permissiontoread = $user->hasRight('bookcal', 'calendar', 'read'); + $permissiontoadd = $user->hasRight('bookcal', 'calendar', 'write'); } else { $permissiontoread = 1; $permissiontoadd = 1; diff --git a/htdocs/bookcal/calendar_contact.php b/htdocs/bookcal/calendar_contact.php index a102542f5ca..8247fa2ca74 100644 --- a/htdocs/bookcal/calendar_contact.php +++ b/htdocs/bookcal/calendar_contact.php @@ -83,8 +83,8 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be includ // Set $enablepermissioncheck to 1 to enable a minimum low level of checks $enablepermissioncheck = 0; if ($enablepermissioncheck) { - $permissiontoread = $user->rights->bookcal->calendar->read; - $permission = $user->rights->bookcal->calendar->write; + $permissiontoread = $user->hasRight('bookcal', 'calendar', 'read'); + $permission = $user->hasRight('bookcal', 'calendar', 'write'); } else { $permissiontoread = 1; $permission = 1; diff --git a/htdocs/bookcal/calendar_document.php b/htdocs/bookcal/calendar_document.php index 07df7276c3a..96b8b5b4d83 100644 --- a/htdocs/bookcal/calendar_document.php +++ b/htdocs/bookcal/calendar_document.php @@ -127,8 +127,8 @@ if ($id > 0 || !empty($ref)) { // Set $enablepermissioncheck to 1 to enable a minimum low level of checks $enablepermissioncheck = 0; if ($enablepermissioncheck) { - $permissiontoread = $user->rights->bookcal->calendar->read; - $permissiontoadd = $user->rights->bookcal->calendar->write; // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles.inc.php + $permissiontoread = $user->hasRight('bookcal', 'calendar', 'read'); + $permissiontoadd = $user->hasRight('bookcal', 'calendar', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles.inc.php } else { $permissiontoread = 1; $permissiontoadd = 1; @@ -245,10 +245,6 @@ print ''; print dol_get_fiche_end(); $modulepart = 'bookcal'; -//$permissiontoadd = $user->rights->bookcal->calendar->write; -$permissiontoadd = 1; -//$permtoedit = $user->rights->bookcal->calendar->write; -$permtoedit = 1; $param = '&id='.$object->id; //$relativepathwithnofile='calendar/' . dol_sanitizeFileName($object->id).'/'; diff --git a/htdocs/bookcal/calendar_note.php b/htdocs/bookcal/calendar_note.php index 69c30f892bb..31f47504264 100644 --- a/htdocs/bookcal/calendar_note.php +++ b/htdocs/bookcal/calendar_note.php @@ -105,9 +105,9 @@ if ($id > 0 || !empty($ref)) { // Set $enablepermissioncheck to 1 to enable a minimum low level of checks $enablepermissioncheck = 0; if ($enablepermissioncheck) { - $permissiontoread = $user->rights->bookcal->calendar->read; - $permissiontoadd = $user->rights->bookcal->calendar->write; - $permissionnote = $user->rights->bookcal->calendar->write; // Used by the include of actions_setnotes.inc.php + $permissiontoread = $user->hasRight('bookcal', 'calendar', 'read'); + $permissiontoadd = $user->hasRight('bookcal', 'calendar', 'write'); + $permissionnote = $user->hasRight('bookcal', 'calendar', 'write'); // Used by the include of actions_setnotes.inc.php } else { $permissiontoread = 1; $permissiontoadd = 1; diff --git a/htdocs/bookcal/class/availabilities.class.php b/htdocs/bookcal/class/availabilities.class.php index d80af0daa87..f4091827496 100644 --- a/htdocs/bookcal/class/availabilities.class.php +++ b/htdocs/bookcal/class/availabilities.class.php @@ -525,14 +525,6 @@ class Availabilities extends CommonObject return 0; } - /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight('bookcal', 'availabilities', 'write')) - || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->bookcal->availabilities->availabilities_advance->validate)))) - { - $this->error='NotEnoughPermissions'; - dol_syslog(get_class($this)."::valid ".$this->error, LOG_ERR); - return -1; - }*/ - $now = dol_now(); $this->db->begin(); @@ -651,13 +643,6 @@ class Availabilities extends CommonObject return 0; } - /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->bookcal->write)) - || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->bookcal->bookcal_advance->validate)))) - { - $this->error='Permission denied'; - return -1; - }*/ - return $this->setStatusCommon($user, self::STATUS_DRAFT, $notrigger, 'AVAILABILITIES_UNVALIDATE'); } @@ -675,13 +660,6 @@ class Availabilities extends CommonObject return 0; } - /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->bookcal->write)) - || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->bookcal->bookcal_advance->validate)))) - { - $this->error='Permission denied'; - return -1; - }*/ - return $this->setStatusCommon($user, self::STATUS_CANCELED, $notrigger, 'AVAILABILITIES_CANCEL'); } @@ -699,13 +677,6 @@ class Availabilities extends CommonObject return 0; } - /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->bookcal->write)) - || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->bookcal->bookcal_advance->validate)))) - { - $this->error='Permission denied'; - return -1; - }*/ - return $this->setStatusCommon($user, self::STATUS_VALIDATED, $notrigger, 'AVAILABILITIES_REOPEN'); } diff --git a/htdocs/bookcal/class/calendar.class.php b/htdocs/bookcal/class/calendar.class.php index 12086607201..37164e56051 100644 --- a/htdocs/bookcal/class/calendar.class.php +++ b/htdocs/bookcal/class/calendar.class.php @@ -482,14 +482,6 @@ class Calendar extends CommonObject return 0; } - /*if (! ((!getDolGlobalInt('MAIN_USE_ADVANCED_PERMS') && !empty($user->rights->bookcal->calendar->write)) - || (getDolGlobalInt('MAIN_USE_ADVANCED_PERMS') && !empty($user->rights->bookcal->calendar->calendar_advance->validate)))) - { - $this->error='NotEnoughPermissions'; - dol_syslog(get_class($this)."::valid ".$this->error, LOG_ERR); - return -1; - }*/ - $now = dol_now(); $this->db->begin(); @@ -608,13 +600,6 @@ class Calendar extends CommonObject return 0; } - /*if (! ((!getDolGlobalInt('MAIN_USE_ADVANCED_PERMS') && !empty($user->rights->bookcal->write)) - || (getDolGlobalInt('MAIN_USE_ADVANCED_PERMS') && !empty($user->rights->bookcal->bookcal_advance->validate)))) - { - $this->error='Permission denied'; - return -1; - }*/ - return $this->setStatusCommon($user, self::STATUS_DRAFT, $notrigger, 'MYOBJECT_UNVALIDATE'); } @@ -632,13 +617,6 @@ class Calendar extends CommonObject return 0; } - /*if (! ((!getDolGlobalInt('MAIN_USE_ADVANCED_PERMS') && !empty($user->rights->bookcal->write)) - || (getDolGlobalInt('MAIN_USE_ADVANCED_PERMS') && !empty($user->rights->bookcal->bookcal_advance->validate)))) - { - $this->error='Permission denied'; - return -1; - }*/ - return $this->setStatusCommon($user, self::STATUS_CANCELED, $notrigger, 'MYOBJECT_CANCEL'); } @@ -656,13 +634,6 @@ class Calendar extends CommonObject return 0; } - /*if (! ((!getDolGlobalInt('MAIN_USE_ADVANCED_PERMS') && !empty($user->rights->bookcal->write)) - || (getDolGlobalInt('MAIN_USE_ADVANCED_PERMS') && !empty($user->rights->bookcal->bookcal_advance->validate)))) - { - $this->error='Permission denied'; - return -1; - }*/ - return $this->setStatusCommon($user, self::STATUS_VALIDATED, $notrigger, 'MYOBJECT_REOPEN'); } diff --git a/htdocs/bookmarks/class/bookmark.class.php b/htdocs/bookmarks/class/bookmark.class.php index c488758008e..1626777c106 100644 --- a/htdocs/bookmarks/class/bookmark.class.php +++ b/htdocs/bookmarks/class/bookmark.class.php @@ -45,12 +45,12 @@ class Bookmark extends CommonObject public $ismultientitymanaged = 1; /** - * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png */ public $picto = 'bookmark'; /** - * @var string Last error number. For example: 'DB_ERROR_RECORD_ALREADY_EXISTS', '12345', ... + * @var string Last error number. For example: 'DB_ERROR_RECORD_ALREADY_EXISTS', '12345', ... */ public $errno; @@ -60,7 +60,7 @@ class Bookmark extends CommonObject public $id; /** - * @var int User ID. If > 0, bookmark of one user. If == 0, bookmark public (for everybody) + * @var int User ID. If > 0, bookmark of one user. If == 0, bookmark public (for everybody) */ public $fk_user; diff --git a/htdocs/categories/class/api_categories.class.php b/htdocs/categories/class/api_categories.class.php index 1f3f114124c..b938298f2c1 100644 --- a/htdocs/categories/class/api_categories.class.php +++ b/htdocs/categories/class/api_categories.class.php @@ -89,7 +89,7 @@ class Categories extends DolibarrApi */ public function get($id, $include_childs = false) { - if (!DolibarrApiAccess::$user->rights->categorie->lire) { + if (!DolibarrApiAccess::$user->hasRight('categorie', 'lire')) { throw new RestException(403); } @@ -136,7 +136,7 @@ class Categories extends DolibarrApi { $obj_ret = array(); - if (!DolibarrApiAccess::$user->rights->categorie->lire) { + if (!DolibarrApiAccess::$user->hasRight('categorie', 'lire')) { throw new RestException(403); } @@ -193,7 +193,7 @@ class Categories extends DolibarrApi */ public function post($request_data = null) { - if (!DolibarrApiAccess::$user->rights->categorie->creer) { + if (!DolibarrApiAccess::$user->hasRight('categorie', 'creer')) { throw new RestException(403); } @@ -224,7 +224,7 @@ class Categories extends DolibarrApi */ public function put($id, $request_data = null) { - if (!DolibarrApiAccess::$user->rights->categorie->creer) { + if (!DolibarrApiAccess::$user->hasRight('categorie', 'creer')) { throw new RestException(403); } @@ -265,7 +265,7 @@ class Categories extends DolibarrApi */ public function delete($id) { - if (!DolibarrApiAccess::$user->rights->categorie->supprimer) { + if (!DolibarrApiAccess::$user->hasRight('categorie', 'supprimer')) { throw new RestException(403); } $result = $this->category->fetch($id); @@ -320,17 +320,17 @@ class Categories extends DolibarrApi throw new RestException(403); } - if ($type == Categorie::TYPE_PRODUCT && !(DolibarrApiAccess::$user->rights->produit->lire || DolibarrApiAccess::$user->rights->service->lire)) { + if ($type == Categorie::TYPE_PRODUCT && !DolibarrApiAccess::$user->hasRight('produit', 'lire') && !DolibarrApiAccess::$user->hasRight('service', 'lire')) { throw new RestException(403); - } elseif ($type == Categorie::TYPE_CONTACT && !DolibarrApiAccess::$user->rights->contact->lire) { + } elseif ($type == Categorie::TYPE_CONTACT && !DolibarrApiAccess::$user->hasRight('contact', 'lire')) { throw new RestException(403); } elseif ($type == Categorie::TYPE_CUSTOMER && !DolibarrApiAccess::$user->hasRight('societe', 'lire')) { throw new RestException(403); - } elseif ($type == Categorie::TYPE_SUPPLIER && !DolibarrApiAccess::$user->rights->fournisseur->lire) { + } elseif ($type == Categorie::TYPE_SUPPLIER && !DolibarrApiAccess::$user->hasRight('fournisseur', 'lire')) { throw new RestException(403); - } elseif ($type == Categorie::TYPE_MEMBER && !DolibarrApiAccess::$user->rights->adherent->lire) { + } elseif ($type == Categorie::TYPE_MEMBER && !DolibarrApiAccess::$user->hasRight('adherent', 'lire')) { throw new RestException(403); - } elseif ($type == Categorie::TYPE_PROJECT && !DolibarrApiAccess::$user->rights->projet->lire) { + } elseif ($type == Categorie::TYPE_PROJECT && !DolibarrApiAccess::$user->hasRight('projet', 'lire')) { throw new RestException(403); } elseif ($type == Categorie::TYPE_KNOWLEDGEMANAGEMENT && !DolibarrApiAccess::$user->hasRight('knowledgemanagement', 'knowledgerecord', 'read')) { throw new RestException(403); @@ -362,7 +362,7 @@ class Categories extends DolibarrApi throw new RestException(403); } - if (!DolibarrApiAccess::$user->rights->categorie->lire) { + if (!DolibarrApiAccess::$user->hasRight('categorie', 'lire')) { throw new RestException(403); } @@ -372,22 +372,22 @@ class Categories extends DolibarrApi } if ($type === Categorie::TYPE_PRODUCT) { - if (!(DolibarrApiAccess::$user->rights->produit->creer || DolibarrApiAccess::$user->rights->service->creer)) { + if (!DolibarrApiAccess::$user->hasRight('produit', 'creer') && !DolibarrApiAccess::$user->hasRight('service', 'creer')) { throw new RestException(403); } $object = new Product($this->db); } elseif ($type === Categorie::TYPE_CUSTOMER) { - if (!DolibarrApiAccess::$user->rights->societe->creer) { + if (!DolibarrApiAccess::$user->hasRight('societe', 'creer')) { throw new RestException(403); } $object = new Societe($this->db); } elseif ($type === Categorie::TYPE_SUPPLIER) { - if (!DolibarrApiAccess::$user->rights->societe->creer) { + if (!DolibarrApiAccess::$user->hasRight('societe', 'creer')) { throw new RestException(403); } $object = new Societe($this->db); } elseif ($type === Categorie::TYPE_CONTACT) { - if (!DolibarrApiAccess::$user->rights->societe->contact->creer) { + if (!DolibarrApiAccess::$user->hasRight('societe', 'contact', 'creer')) { throw new RestException(403); } $object = new Contact($this->db); @@ -416,7 +416,7 @@ class Categories extends DolibarrApi return array( 'success' => array( 'code' => 200, - 'message' => 'Objects succefully linked to the category' + 'message' => 'Objects successfully linked to the category' ) ); } @@ -442,7 +442,7 @@ class Categories extends DolibarrApi throw new RestException(403); } - if (!DolibarrApiAccess::$user->rights->categorie->lire) { + if (!DolibarrApiAccess::$user->hasRight('categorie', 'lire')) { throw new RestException(403); } @@ -452,22 +452,22 @@ class Categories extends DolibarrApi } if ($type === Categorie::TYPE_PRODUCT) { - if (!(DolibarrApiAccess::$user->rights->produit->creer || DolibarrApiAccess::$user->rights->service->creer)) { + if (!DolibarrApiAccess::$user->hasRight('produit', 'creer') && !DolibarrApiAccess::$user->hasRight('service', 'creer')) { throw new RestException(403); } $object = new Product($this->db); } elseif ($type === Categorie::TYPE_CUSTOMER) { - if (!DolibarrApiAccess::$user->rights->societe->creer) { + if (!DolibarrApiAccess::$user->hasRight('societe', 'creer')) { throw new RestException(403); } $object = new Societe($this->db); } elseif ($type === Categorie::TYPE_SUPPLIER) { - if (!DolibarrApiAccess::$user->rights->societe->creer) { + if (!DolibarrApiAccess::$user->hasRight('societe', 'creer')) { throw new RestException(403); } $object = new Societe($this->db); } elseif ($type === Categorie::TYPE_CONTACT) { - if (!DolibarrApiAccess::$user->rights->societe->contact->creer) { + if (!DolibarrApiAccess::$user->hasRight('societe', 'contact', 'creer')) { throw new RestException(403); } $object = new Contact($this->db); @@ -496,7 +496,7 @@ class Categories extends DolibarrApi return array( 'success' => array( 'code' => 200, - 'message' => 'Objects succefully linked to the category' + 'message' => 'Objects successfully linked to the category' ) ); } @@ -522,7 +522,7 @@ class Categories extends DolibarrApi throw new RestException(403); } - if (!DolibarrApiAccess::$user->rights->categorie->lire) { + if (!DolibarrApiAccess::$user->hasRight('categorie', 'lire')) { throw new RestException(403); } @@ -532,22 +532,22 @@ class Categories extends DolibarrApi } if ($type === Categorie::TYPE_PRODUCT) { - if (!(DolibarrApiAccess::$user->rights->produit->creer || DolibarrApiAccess::$user->rights->service->creer)) { + if (!DolibarrApiAccess::$user->hasRight('produit', 'creer') && !DolibarrApiAccess::$user->hasRight('service', 'creer')) { throw new RestException(403); } $object = new Product($this->db); } elseif ($type === Categorie::TYPE_CUSTOMER) { - if (!DolibarrApiAccess::$user->rights->societe->creer) { + if (!DolibarrApiAccess::$user->hasRight('societe', 'creer')) { throw new RestException(403); } $object = new Societe($this->db); } elseif ($type === Categorie::TYPE_SUPPLIER) { - if (!DolibarrApiAccess::$user->rights->societe->creer) { + if (!DolibarrApiAccess::$user->hasRight('societe', 'creer')) { throw new RestException(403); } $object = new Societe($this->db); } elseif ($type === Categorie::TYPE_CONTACT) { - if (!DolibarrApiAccess::$user->rights->societe->contact->creer) { + if (!DolibarrApiAccess::$user->hasRight('societe', 'contact', 'creer')) { throw new RestException(403); } $object = new Contact($this->db); @@ -574,7 +574,7 @@ class Categories extends DolibarrApi return array( 'success' => array( 'code' => 200, - 'message' => 'Objects succefully unlinked from the category' + 'message' => 'Objects successfully unlinked from the category' ) ); } @@ -600,7 +600,7 @@ class Categories extends DolibarrApi throw new RestException(403); } - if (!DolibarrApiAccess::$user->rights->categorie->lire) { + if (!DolibarrApiAccess::$user->hasRight('categorie', 'lire')) { throw new RestException(403); } @@ -610,22 +610,22 @@ class Categories extends DolibarrApi } if ($type === Categorie::TYPE_PRODUCT) { - if (!(DolibarrApiAccess::$user->rights->produit->creer || DolibarrApiAccess::$user->rights->service->creer)) { + if (!DolibarrApiAccess::$user->hasRight('produit', 'creer') && !DolibarrApiAccess::$user->hasRight('service', 'creer')) { throw new RestException(403); } $object = new Product($this->db); } elseif ($type === Categorie::TYPE_CUSTOMER) { - if (!DolibarrApiAccess::$user->rights->societe->creer) { + if (!DolibarrApiAccess::$user->hasRight('societe', 'creer')) { throw new RestException(403); } $object = new Societe($this->db); } elseif ($type === Categorie::TYPE_SUPPLIER) { - if (!DolibarrApiAccess::$user->rights->societe->creer) { + if (!DolibarrApiAccess::$user->hasRight('societe', 'creer')) { throw new RestException(403); } $object = new Societe($this->db); } elseif ($type === Categorie::TYPE_CONTACT) { - if (!DolibarrApiAccess::$user->rights->societe->contact->creer) { + if (!DolibarrApiAccess::$user->hasRight('societe', 'contact', 'creer')) { throw new RestException(403); } $object = new Contact($this->db); @@ -652,7 +652,7 @@ class Categories extends DolibarrApi return array( 'success' => array( 'code' => 200, - 'message' => 'Objects succefully unlinked from the category' + 'message' => 'Objects successfully unlinked from the category' ) ); } @@ -753,7 +753,7 @@ class Categories extends DolibarrApi { dol_syslog("getObjects($id, $type, $onlyids)", LOG_DEBUG); - if (!DolibarrApiAccess::$user->rights->categorie->lire) { + if (!DolibarrApiAccess::$user->hasRight('categorie', 'lire')) { throw new RestException(403); } diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index 75fcab83c19..a7a13ff64d1 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -1025,7 +1025,7 @@ if ($type == Categorie::TYPE_PROJECT) { if ($user->hasRight("project", "read")) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; - $permission = $user->rights->projet->creer; + $permission = $user->hasRight('projet', 'creer'); $objects = $object->getObjectsInCateg($type, 0, $limit, $offset); if ($objects < 0) { diff --git a/htdocs/comm/action/class/actioncommreminder.class.php b/htdocs/comm/action/class/actioncommreminder.class.php index fff59f3fd11..81d6249eaad 100644 --- a/htdocs/comm/action/class/actioncommreminder.class.php +++ b/htdocs/comm/action/class/actioncommreminder.class.php @@ -41,7 +41,7 @@ class ActionCommReminder extends CommonObject public $table_element = 'actioncomm_reminder'; /** - * @var array Does actioncommreminder support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe + * @var int Does actioncommreminder support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe */ public $ismultientitymanaged = 0; diff --git a/htdocs/comm/action/class/api_agendaevents.class.php b/htdocs/comm/action/class/api_agendaevents.class.php index d9f2c1df577..9c266c92cb6 100644 --- a/htdocs/comm/action/class/api_agendaevents.class.php +++ b/htdocs/comm/action/class/api_agendaevents.class.php @@ -63,7 +63,7 @@ class AgendaEvents extends DolibarrApi */ public function get($id) { - if (!DolibarrApiAccess::$user->rights->agenda->myactions->read) { + if (!DolibarrApiAccess::$user->hasRight('agenda', 'myactions', 'read')) { throw new RestException(401, "Insufficient rights to read an event"); } if ($id === 0) { @@ -79,7 +79,7 @@ class AgendaEvents extends DolibarrApi throw new RestException(404, 'Agenda Events not found'); } - if (!DolibarrApiAccess::$user->rights->agenda->allactions->read && $this->actioncomm->userownerid != DolibarrApiAccess::$user->id) { + if (!DolibarrApiAccess::$user->hasRight('agenda', 'allactions', 'read') && $this->actioncomm->userownerid != DolibarrApiAccess::$user->id) { throw new RestException(401, 'Insufficient rights to read event of this owner id. Your id is '.DolibarrApiAccess::$user->id); } @@ -109,7 +109,7 @@ class AgendaEvents extends DolibarrApi $obj_ret = array(); - if (!DolibarrApiAccess::$user->rights->agenda->myactions->read) { + if (!DolibarrApiAccess::$user->hasRight('agenda', 'myactions', 'read')) { throw new RestException(401, "Insufficient rights to read events"); } @@ -191,7 +191,7 @@ class AgendaEvents extends DolibarrApi */ public function post($request_data = null) { - if (!DolibarrApiAccess::$user->rights->agenda->myactions->create) { + if (!DolibarrApiAccess::$user->hasRight('agenda', 'myactions', 'create')) { throw new RestException(401, "Insufficient rights to create your Agenda Event"); } if (!DolibarrApiAccess::$user->hasRight('agenda', 'allactions', 'create') && DolibarrApiAccess::$user->id != $request_data['userownerid']) { @@ -236,7 +236,7 @@ class AgendaEvents extends DolibarrApi */ public function put($id, $request_data = null) { - if (!DolibarrApiAccess::$user->rights->agenda->myactions->create) { + if (!DolibarrApiAccess::$user->hasRight('agenda', 'myactions', 'create')) { throw new RestException(401, "Insufficient rights to create your Agenda Event"); } if (!DolibarrApiAccess::$user->hasRight('agenda', 'allactions', 'create') && DolibarrApiAccess::$user->id != $request_data['userownerid']) { @@ -296,7 +296,7 @@ class AgendaEvents extends DolibarrApi $this->actioncomm->oldcopy = clone $this->actioncomm; } - if (!DolibarrApiAccess::$user->rights->agenda->allactions->delete && DolibarrApiAccess::$user->id != $this->actioncomm->userownerid) { + if (!DolibarrApiAccess::$user->hasRight('agenda', 'allactions', 'delete') && DolibarrApiAccess::$user->id != $this->actioncomm->userownerid) { throw new RestException(401, "Insufficient rights to delete an Agenda Event of owner id ".$this->actioncomm->userownerid.' Your id is '.DolibarrApiAccess::$user->id); } diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index ad681813b42..cbf37aae56d 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -58,6 +58,7 @@ $filter = GETPOST("search_filter", 'alpha', 3) ? GETPOST("search_filter", 'alpha $filtert = GETPOST("search_filtert", "int", 3) ? GETPOST("search_filtert", "int", 3) : GETPOST("filtert", "int", 3); $usergroup = GETPOST("search_usergroup", "int", 3) ? GETPOST("search_usergroup", "int", 3) : GETPOST("usergroup", "int", 3); $showbirthday = empty($conf->use_javascript_ajax) ? GETPOST("showbirthday", "int") : 1; +$search_categ_cus = GETPOST("search_categ_cus", "int", 3) ? GETPOST("search_categ_cus", "int", 3) : 0; // If not choice done on calendar owner (like on left menu link "Agenda"), we filter on user. if (empty($filtert) && !getDolGlobalString('AGENDA_ALL_CALENDARS')) { @@ -419,6 +420,9 @@ $param .= "&maxprint=".urlencode($maxprint); if ($mode == 'show_day' || $mode == 'show_week' || $mode == 'show_month') { $param .= '&mode='.urlencode($mode); } +if ($search_categ_cus != 0) { + $param .= '&search_categ_cus='.urlencode($search_categ_cus); +} // Show navigation bar $nav = ''; @@ -843,11 +847,20 @@ if ($filtert > 0 || $usergroup > 0) { } $sql .= ")"; } + +// Search in categories, -1 is all and -2 is no categories +if ($search_categ_cus != -1) { + if ($search_categ_cus == -2) { + $sql .= " AND NOT EXISTS (SELECT ca.fk_actioncomm FROM ".MAIN_DB_PREFIX."categorie_actioncomm as ca WHERE ca.fk_actioncomm = a.id)"; + } elseif ($search_categ_cus > 0) { + $sql .= " AND EXISTS (SELECT ca.fk_actioncomm FROM ".MAIN_DB_PREFIX."categorie_actioncomm as ca WHERE ca.fk_actioncomm = a.id AND ca.fk_categorie IN (".$db->sanitize($search_categ_cus)."))"; + } +} + // Sort on date $sql .= ' ORDER BY datep'; //print $sql; - dol_syslog("comm/action/index.php", LOG_DEBUG); $resql = $db->query($sql); if ($resql) { @@ -1495,7 +1508,7 @@ if (empty($mode) || $mode == 'show_month') { // View by month $newparam .= '&viewcal=1'; print '
'; - print_actions_filter($form, $canedit, $status, $year, $month, $day, $showbirthday, 0, $filtert, 0, $pid, $socid, $action, -1, $actioncode, $usergroup, '', $resourceid); + print_actions_filter($form, $canedit, $status, $year, $month, $day, $showbirthday, 0, $filtert, 0, $pid, $socid, $action, -1, $actioncode, $usergroup, '', $resourceid, $search_categ_cus); print '
'; print '
'; diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index 9e7faf0f372..55cb92d71f3 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -96,6 +96,7 @@ $filter = GETPOST("search_filter", 'alpha', 3) ? GETPOST("search_filter", 'alpha $filtert = GETPOST("search_filtert", "int", 3) ? GETPOST("search_filtert", "int", 3) : GETPOST("filtert", "int", 3); $usergroup = GETPOST("search_usergroup", "int", 3) ? GETPOST("search_usergroup", "int", 3) : GETPOST("usergroup", "int", 3); $showbirthday = empty($conf->use_javascript_ajax) ? (GETPOST("search_showbirthday", "int") ? GETPOST("search_showbirthday", "int") : GETPOST("showbirthday", "int")) : 1; +$search_categ_cus = GETPOST("search_categ_cus", "int", 3) ? GETPOST("search_categ_cus", "int", 3) : 0; // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $object = new ActionComm($db); @@ -267,7 +268,7 @@ if (empty($reshook)) { $objectlabel = 'Events'; $uploaddir = true; // Only users that can delete any event can remove records. - $permissiontodelete = $user->rights->agenda->allactions->delete; + $permissiontodelete = $user->hasRight('agenda', 'allactions', 'delete'); $permissiontoadd = $user->hasRight('agenda', 'myactions', 'create'); include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } @@ -388,6 +389,10 @@ if (GETPOST('dateend_dtendyear', 'int')) { if ($optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); } +if ($search_categ_cus != 0) { + $param .= '&search_categ_cus='.urlencode($search_categ_cus); +} + // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; @@ -569,6 +574,15 @@ if ($dateend_dtend > 0) { $sql .= " AND a.datep2 <= '".$db->idate($dateend_dtend)."'"; } +// Search in categories, -1 is all and -2 is no categories +if ($search_categ_cus != -1) { + if ($search_categ_cus == -2) { + $sql .= " AND NOT EXISTS (SELECT ca.fk_actioncomm FROM ".MAIN_DB_PREFIX."categorie_actioncomm as ca WHERE ca.fk_actioncomm = a.id)"; + } elseif ($search_categ_cus > 0) { + $sql .= " AND EXISTS (SELECT ca.fk_actioncomm FROM ".MAIN_DB_PREFIX."categorie_actioncomm as ca WHERE ca.fk_actioncomm = a.id AND ca.fk_categorie IN (".$db->sanitize($search_categ_cus)."))"; + } +} + // Add where from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; @@ -737,7 +751,7 @@ if ($massactionbutton) { $i = 0; print '
'; -print_actions_filter($form, $canedit, $search_status, $year, $month, $day, $showbirthday, 0, $filtert, 0, $pid, $socid, $action, -1, $actioncode, $usergroup, '', $resourceid); +print_actions_filter($form, $canedit, $search_status, $year, $month, $day, $showbirthday, 0, $filtert, 0, $pid, $socid, $action, -1, $actioncode, $usergroup, '', $resourceid, $search_categ_cus); print '
'; print '
'; diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index 94fb5f6c971..3eb60cff172 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -107,6 +107,7 @@ $status = GETPOSTISSET("search_status") ? GETPOST("search_status", 'aZ09') : GET $type = GETPOSTISSET("search_type") ? GETPOST("search_type", 'alpha') : GETPOST("type", 'alpha'); $maxprint = ((GETPOST("maxprint", 'int') != '') ? GETPOST("maxprint", 'int') : $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW); $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') +$search_categ_cus = GETPOST("search_categ_cus", "int", 3) ? GETPOST("search_categ_cus", "int", 3) : 0; // Set actioncode (this code must be same for setting actioncode into peruser, listacton and index) if (GETPOST('search_actioncode', 'array:aZ09')) { $actioncode = GETPOST('search_actioncode', 'array:aZ09', 3); @@ -322,6 +323,9 @@ if ($begin_d != '') { if ($end_d != '') { $param .= '&end_d='.urlencode($end_d); } +if ($search_categ_cus != 0) { + $param .= '&search_categ_cus='.urlencode($search_categ_cus); +} $param .= "&maxprint=".urlencode($maxprint); $paramnoactionodate = $param; @@ -513,7 +517,7 @@ $s = $newtitle; print $s; print '
'; -print_actions_filter($form, $canedit, $search_status, $year, $month, $day, $showbirthday, 0, $filtert, 0, $pid, $socid, $action, -1, $actioncode, $usergroup, '', $resourceid); +print_actions_filter($form, $canedit, $search_status, $year, $month, $day, $showbirthday, 0, $filtert, 0, $pid, $socid, $action, -1, $actioncode, $usergroup, '', $resourceid, $search_categ_cus); print '
'; @@ -650,6 +654,14 @@ if ($status == 'done' || $status == '100') { if ($status == 'todo') { $sql .= " AND (a.percent >= 0 AND a.percent < 100)"; } +// Search in categories, -1 is all and -2 is no categories +if ($search_categ_cus != -1) { + if ($search_categ_cus == -2) { + $sql .= " AND NOT EXISTS (SELECT ca.fk_actioncomm FROM ".MAIN_DB_PREFIX."categorie_actioncomm as ca WHERE ca.fk_actioncomm = a.id)"; + } elseif ($search_categ_cus > 0) { + $sql .= " AND EXISTS (SELECT ca.fk_actioncomm FROM ".MAIN_DB_PREFIX."categorie_actioncomm as ca WHERE ca.fk_actioncomm = a.id AND ca.fk_categorie IN (".$db->sanitize($search_categ_cus)."))"; + } +} // Sort on date $sql .= $db->order("fk_user_action, datep"); //print $sql; diff --git a/htdocs/comm/mailing/advtargetemailing.php b/htdocs/comm/mailing/advtargetemailing.php index fa08d145abf..73fc1826706 100644 --- a/htdocs/comm/mailing/advtargetemailing.php +++ b/htdocs/comm/mailing/advtargetemailing.php @@ -459,7 +459,7 @@ if ($object->fetch($id) >= 0) { print "
"; // Show email selectors - if ($object->statut == 0 && $user->hasRight('mailing', 'creer')) { + if ($object->status == 0 && $user->hasRight('mailing', 'creer')) { include DOL_DOCUMENT_ROOT.'/core/tpl/advtarget.tpl.php'; } } diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index e4d199d5ff6..3b7497bdc7a 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -161,7 +161,7 @@ if (empty($reshook)) { setEventMessages($langs->trans("NotEnoughPermissions"), null, 'warnings'); $action = ''; } else { - if ($object->statut == 0) { + if ($object->status == 0) { dol_print_error(null, 'ErrorMailIsNotValidated'); exit; } @@ -546,6 +546,7 @@ if (empty($reshook)) { if ($action == 'add') { $mesgs = array(); + $object->messtype = (string) GETPOST("messtype"); $object->email_from = (string) GETPOST("from", 'alphawithlgt'); // Must allow 'name ' $object->email_replyto = (string) GETPOST("replyto", 'alphawithlgt'); // Must allow 'name ' $object->email_errorsto = (string) GETPOST("errorsto", 'alphawithlgt'); // Must allow 'name ' @@ -558,7 +559,7 @@ if (empty($reshook)) { if (!$object->title) { $mesgs[] = $langs->trans("ErrorFieldRequired", $langs->transnoentities("MailTitle")); } - if (!$object->sujet) { + if ($object->messtype != 'sms' && !$object->sujet) { $mesgs[] = $langs->trans("ErrorFieldRequired", $langs->transnoentities("MailTopic")); } if (!$object->body) { @@ -644,12 +645,14 @@ if (empty($reshook)) { if (!$isupload) { $mesgs = array(); + + //$object->messtype = (string) GETPOST("messtype"); // We must not be able to change the messtype $object->sujet = (string) GETPOST("sujet"); $object->body = (string) GETPOST("bodyemail", 'restricthtml'); $object->bgcolor = preg_replace('/^#/', '', (string) GETPOST("bgcolor")); $object->bgimage = (string) GETPOST("bgimage"); - if (!$object->sujet) { + if ($object->messtype != 'sms' && !$object->sujet) { $mesgs[] = $langs->trans("ErrorFieldRequired", $langs->transnoentities("MailTopic")); } if (!$object->body) { @@ -776,7 +779,7 @@ if ($action == 'create') { $htmltext .= ''; - $availablelink = $form->textwithpicto(''.$langs->trans("AvailableVariables").'', $htmltext, 1, 'help', '', 0, 2, 'availvar'); + $availablelink = $form->textwithpicto(''.$langs->trans("AvailableVariables").'', $htmltext, 1, 'helpclickable', '', 0, 2, 'availvar'); //print ''.img_picto($langs->trans("ClickToShowDescription"), $imginfo).''; @@ -789,9 +792,40 @@ if ($action == 'create') { print '
'; - print ''; + if (getDolGlobalInt('EMAILINGS_SUPPORT_ALSO_SMS')) { + $arrayoftypes = array("email" => "Email", "sms" => "SMS"); + print ''; + print ''; + + print ''; + } + print '
'.$langs->trans("Fields").''.$langs->trans("Type").''.$langs->trans("Index").''.$langs->trans("Fields").''.$langs->trans("Type").''.$langs->trans("Collation").''.$langs->trans("Null").''.$langs->trans("Index").''.$langs->trans("Default").''.$langs->trans("Extra").''.$langs->trans("Privileges").''.$langs->trans("FieldsLinked").'
".$row[0]."".$row[1]."".$row[2]."".$row[3]."".(empty($row[4]) ? '' : $row[4])."".(empty($row[5]) ? '' : $row[5])."".(empty($row[6]) ? '' : $row[6])."".(empty($row[7]) ? '' : $row[7])."".(isset($link[$row[0]][0]) ? $link[$row[0]][0] : '')."."; diff --git a/htdocs/admin/system/modules.php b/htdocs/admin/system/modules.php index b80b309b512..4cd42fe0243 100644 --- a/htdocs/admin/system/modules.php +++ b/htdocs/admin/system/modules.php @@ -157,7 +157,7 @@ foreach ($modules as $key => $module) { if (empty($rights[0])) { continue; } - $arrayofpermissions[$rights[0]] = array('label'=> 'user->rights->'.$module->rights_class.'->'.$rights[4].(empty($rights[5]) ? '' : '->'.$rights[5])); + $arrayofpermissions[$rights[0]] = array('label'=> 'user->hasRight(\''.$module->rights_class.'\', \''.$rights[4].'\''.(empty($rights[5]) ? '' : ', \''.$rights[5].'\'').')'); $permission[] = $rights[0]; array_push($rights_ids, $rights[0]); diff --git a/htdocs/api/class/api_access.class.php b/htdocs/api/class/api_access.class.php index e46dfd14d86..82a60bc5116 100644 --- a/htdocs/api/class/api_access.class.php +++ b/htdocs/api/class/api_access.class.php @@ -62,7 +62,7 @@ class DolibarrApiAccess implements iAuthenticate /** * @var User $user Loggued user */ - public static $user = ''; + public static $user = null; /** diff --git a/htdocs/api/class/api_documents.class.php b/htdocs/api/class/api_documents.class.php index 715bfab4b8e..826229b1047 100644 --- a/htdocs/api/class/api_documents.class.php +++ b/htdocs/api/class/api_documents.class.php @@ -338,7 +338,7 @@ class Documents extends DolibarrApi require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; // Can get doc if has permission to read all user or if it is user itself - if (!DolibarrApiAccess::$user->rights->user->user->lire && DolibarrApiAccess::$user->id != $id) { + if (!DolibarrApiAccess::$user->hasRight('user', 'user', 'lire') && DolibarrApiAccess::$user->id != $id) { throw new RestException(403); } @@ -352,7 +352,7 @@ class Documents extends DolibarrApi } elseif ($modulepart == 'adherent' || $modulepart == 'member') { require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; - if (!DolibarrApiAccess::$user->rights->adherent->lire) { + if (!DolibarrApiAccess::$user->hasRight('adherent', 'lire')) { throw new RestException(403); } @@ -380,7 +380,7 @@ class Documents extends DolibarrApi } elseif ($modulepart == 'supplier_proposal') { require_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php'; - if (!DolibarrApiAccess::$user->rights->supplier_proposal->read) { + if (!DolibarrApiAccess::$user->hasRight('supplier_proposal', 'read')) { throw new RestException(403); } @@ -410,7 +410,7 @@ class Documents extends DolibarrApi require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; - if (empty(DolibarrApiAccess::$user->rights->fournisseur->commande->lire) && empty(DolibarrApiAccess::$user->rights->supplier_order->lire)) { + if (!DolibarrApiAccess::$user->hasRight('fournisseur', 'commande', 'lire') && !DolibarrApiAccess::$user->hasRight('supplier_order', 'lire')) { throw new RestException(403); } @@ -424,7 +424,7 @@ class Documents extends DolibarrApi } elseif ($modulepart == 'shipment' || $modulepart == 'expedition') { require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php'; - if (!DolibarrApiAccess::$user->rights->expedition->lire) { + if (!DolibarrApiAccess::$user->hasRight('expedition', 'lire')) { throw new RestException(403); } @@ -468,7 +468,7 @@ class Documents extends DolibarrApi } elseif ($modulepart == 'produit' || $modulepart == 'product') { require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; - if (!DolibarrApiAccess::$user->rights->produit->lire) { + if (!DolibarrApiAccess::$user->hasRight('produit', 'lire')) { throw new RestException(403); } @@ -484,7 +484,7 @@ class Documents extends DolibarrApi } elseif ($modulepart == 'agenda' || $modulepart == 'action' || $modulepart == 'event') { require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; - if (!DolibarrApiAccess::$user->rights->agenda->myactions->read && !DolibarrApiAccess::$user->rights->agenda->allactions->read) { + if (!DolibarrApiAccess::$user->hasRight('agenda', 'myactions', 'read') && !DolibarrApiAccess::$user->hasRight('agenda', 'allactions', 'read')) { throw new RestException(403); } @@ -498,7 +498,7 @@ class Documents extends DolibarrApi } elseif ($modulepart == 'expensereport') { require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; - if (!DolibarrApiAccess::$user->rights->expensereport->read && !DolibarrApiAccess::$user->rights->expensereport->read) { + if (!DolibarrApiAccess::$user->hasRight('expensereport', 'read') && !DolibarrApiAccess::$user->hasRights('expensereport', 'read')) { throw new RestException(403); } @@ -541,7 +541,7 @@ class Documents extends DolibarrApi throw new RestException(500, 'Modulepart Ecm not implemented yet.'); // require_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmdirectory.class.php'; - // if (!DolibarrApiAccess::$user->rights->ecm->read) { + // if (!DolibarrApiAccess::$user->hasRight('ecm', 'read')) { // throw new RestException(403); // } diff --git a/htdocs/asset/document.php b/htdocs/asset/document.php index e6359b3a190..460b30d1a90 100644 --- a/htdocs/asset/document.php +++ b/htdocs/asset/document.php @@ -73,7 +73,7 @@ if ($id > 0 || !empty($ref)) { $upload_dir = $conf->asset->multidir_output[$object->entity ? $object->entity : $conf->entity]."/".get_exdir(0, 0, 0, 1, $object); } -$permissiontoadd = $user->rights->asset->write; // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles.inc.php +$permissiontoadd = $user->hasRight('asset', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles.inc.php // Security check (enable the most restrictive one) if ($user->socid > 0) { diff --git a/htdocs/bom/bom_agenda.php b/htdocs/bom/bom_agenda.php index 794622791a0..d4fb24d6daa 100644 --- a/htdocs/bom/bom_agenda.php +++ b/htdocs/bom/bom_agenda.php @@ -159,8 +159,7 @@ if ($object->id > 0) { { $langs->load("projects"); $morehtmlref.='
'.$langs->trans('Project') . ' '; - if ($user->rights->bom->creer) - { + if ($user->hasRight('bom', 'creer')) { if ($action != 'classify') //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; $morehtmlref.=' : '; diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index 5b105fda2cf..5dda67de5a3 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -513,8 +513,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $morehtmlref = '
'; /* // Ref bis - $morehtmlref.=$form->editfieldkey("RefBis", 'ref_client', $object->ref_client, $object, $user->rights->bom->creer, 'string', '', 0, 1); - $morehtmlref.=$form->editfieldval("RefBis", 'ref_client', $object->ref_client, $object, $user->rights->bom->creer, 'string', '', null, null, '', 1); + $morehtmlref.=$form->editfieldkey("RefBis", 'ref_client', $object->ref_client, $object, $user->hasRight('bom', 'creer'), 'string', '', 0, 1); + $morehtmlref.=$form->editfieldval("RefBis", 'ref_client', $object->ref_client, $object, $user->hasRight('bom', 'creer'), 'string', '', null, null, '', 1); // Thirdparty $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1); // Project @@ -759,18 +759,14 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } /* - if ($user->rights->bom->write) - { - if ($object->status == 1) - { - print ''.$langs->trans("Disable").''."\n"; + if ($user->hasRight('bom', 'write')) { + if ($object->status == 1) { + print ''.$langs->trans("Disable").''."\n"; + } else { + print ''.$langs->trans("Enable").''."\n"; + } } - else - { - print ''.$langs->trans("Enable").''."\n"; - } - } - */ + */ // Delete print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $permissiontodelete); diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 007e6b12557..12573e3f1a9 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -934,14 +934,6 @@ class BOM extends CommonObject return 0; } - /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->bom->create)) - || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->bom->bom_advance->validate)))) - { - $this->error='NotEnoughPermissions'; - dol_syslog(get_class($this)."::valid ".$this->error, LOG_ERR); - return -1; - }*/ - $now = dol_now(); $this->db->begin(); @@ -1054,13 +1046,6 @@ class BOM extends CommonObject return 0; } - /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->bom->write)) - || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->bom->bom_advance->validate)))) - { - $this->error='Permission denied'; - return -1; - }*/ - return $this->setStatusCommon($user, self::STATUS_DRAFT, $notrigger, 'BOM_UNVALIDATE'); } @@ -1078,13 +1063,6 @@ class BOM extends CommonObject return 0; } - /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->bom->write)) - || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->bom->bom_advance->validate)))) - { - $this->error='Permission denied'; - return -1; - }*/ - return $this->setStatusCommon($user, self::STATUS_CANCELED, $notrigger, 'BOM_CLOSE'); } @@ -1102,13 +1080,6 @@ class BOM extends CommonObject return 0; } - /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->bom->write)) - || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->bom->bom_advance->validate)))) - { - $this->error='Permission denied'; - return -1; - }*/ - return $this->setStatusCommon($user, self::STATUS_VALIDATED, $notrigger, 'BOM_REOPEN'); } @@ -1840,7 +1811,7 @@ class BOMLine extends CommonObjectLine public $unit_cost = 0; /** - * @var Bom array of Bom in line + * @var array array of Bom in line */ public $childBom = array(); diff --git a/htdocs/bom/tpl/objectline_title.tpl.php b/htdocs/bom/tpl/objectline_title.tpl.php index 703feaccf14..680ac6d1079 100644 --- a/htdocs/bom/tpl/objectline_title.tpl.php +++ b/htdocs/bom/tpl/objectline_title.tpl.php @@ -24,8 +24,8 @@ * $object (invoice, order, ...) * $conf * $langs - * $element (used to test $user->rights->$element->creer) - * $permtoedit (used to replace test $user->rights->$element->creer) + * $element (used to test $user->hasRight($element, 'creer')) + * $permtoedit (used to replace test $user->hasRight($element, 'creer')) * $inputalsopricewithtax (0 by default, 1 to also show column with unit price including tax) * $outputalsopricetotalwithtax * $usemargins (0 to disable all margins columns, 1 to show according to margin setup) diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php index 1c7b193d2d5..f01a7600c18 100644 --- a/htdocs/bom/tpl/objectline_view.tpl.php +++ b/htdocs/bom/tpl/objectline_view.tpl.php @@ -25,8 +25,8 @@ * $conf * $langs * $forceall (0 by default, 1 for supplier invoices/orders) - * $element (used to test $user->rights->$element->creer) - * $permtoedit (used to replace test $user->rights->$element->creer) + * $element (used to test $user->hasRight($element, 'creer')) + * $permtoedit (used to replace test $user->hasRight($element, 'creer')) * $inputalsopricewithtax (0 by default, 1 to also show column with unit price including tax) * $object_rights->creer initialized from = $object->getRights() * $disableedit, $disablemove, $disableremove @@ -328,7 +328,7 @@ if ($resql) { $workstation = new Workstation($this->db); $res = $workstation->fetch($sub_bom_product->fk_default_workstation); if ($res > 0) { - $sub_bom_line->total_cost = price2num($qty * ($workstation->thm_operator_estimated + $workstation->thm_machine_estimated), 'MT'); + $sub_bom_line->total_cost = (float) price2num($qty * ($workstation->thm_operator_estimated + $workstation->thm_machine_estimated), 'MT'); } print '
'.price(price2num($sub_bom_line->total_cost, 'MT')).'
'.$langs->trans("MailTitle").'
'.$langs->trans("MailFrom").'
'.$langs->trans("Type").''; + print $form->selectarray('messtype', $arrayoftypes, (GETPOSTISSET('messtype') ? GETPOST('messtype') : 'email'), 0, 0); - print '
'.$langs->trans("MailErrorsTo").'
'; + + print '

'; + + print ''; + + print ''; + print ''; + + print ''; // Other attributes $parameters = array(); @@ -805,8 +839,8 @@ if ($action == 'create') { print '

'; print '
'.$langs->trans("MailFrom").'
'.$langs->trans("MailErrorsTo").'
'; - print ''; - print ''; + print ''; @@ -821,7 +855,7 @@ if ($action == 'create') { print dol_get_fiche_end(); - print $form->buttonsSaveCancel("CreateMailing", 'Cancel'); + print $form->buttonsSaveCancel("Create", 'Cancel'); print ''; } else { @@ -844,7 +878,7 @@ if ($action == 'create') { print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id.(!empty($urlfrom) ? '&urlfrom='.urlencode($urlfrom) : ''), $langs->trans("DeleteAMailing"), $langs->trans("ConfirmDeleteMailing"), "confirm_delete", '', '', 1); } - if ($action != 'edit' && $action != 'edithtml') { + if ($action != 'edit' && $action != 'edittxt' &&$action != 'edithtml') { print dol_get_fiche_head($head, 'card', $langs->trans("Mailing"), -1, 'email'); /* @@ -933,7 +967,7 @@ if ($action == 'create') { $morehtmlright = ''; $nbtry = $nbok = 0; - if ($object->statut == 2 || $object->statut == 3) { + if ($object->status == 2 || $object->status == 3) { $nbtry = $object->countNbOfTargets('alreadysent'); $nbko = $object->countNbOfTargets('alreadysentko'); @@ -953,9 +987,9 @@ if ($action == 'create') { // From print ''; // Errors to - print ''; } - print ''; print '
'.$langs->trans("MailTopic").'
'.$langs->trans("BackgroundColorByDefault").''; + print '
'.$langs->trans("MailTopic").'
'.$langs->trans("BackgroundColorByDefault").''; print $htmlother->selectColor(GETPOST('bgcolor'), 'bgcolor', '', 0); print '
'; - print $form->editfieldkey("MailFrom", 'email_from', $object->email_from, $object, $user->hasRight('mailing', 'creer') && $object->statut < 3, 'string'); + print $form->editfieldkey("MailFrom", 'email_from', $object->email_from, $object, $user->hasRight('mailing', 'creer') && $object->status < $object::STATUS_SENTCOMPLETELY, 'string'); print ''; - print $form->editfieldval("MailFrom", 'email_from', $object->email_from, $object, $user->hasRight('mailing', 'creer') && $object->statut < 3, 'string'); + print $form->editfieldval("MailFrom", 'email_from', $object->email_from, $object, $user->hasRight('mailing', 'creer') && $object->status < $object::STATUS_SENTCOMPLETELY, 'string'); $email = CMailFile::getValidAddress($object->email_from, 2); if ($email && !isValidEmail($email)) { $langs->load("errors"); @@ -968,19 +1002,21 @@ if ($action == 'create') { print '
'; - print $form->editfieldkey("MailErrorsTo", 'email_errorsto', $object->email_errorsto, $object, $user->hasRight('mailing', 'creer') && $object->statut < 3, 'string'); - print ''; - print $form->editfieldval("MailErrorsTo", 'email_errorsto', $object->email_errorsto, $object, $user->hasRight('mailing', 'creer') && $object->statut < 3, 'string'); - $email = CMailFile::getValidAddress($object->email_errorsto, 2); - if ($email && !isValidEmail($email)) { - $langs->load("errors"); - print img_warning($langs->trans("ErrorBadEMail", $email)); - } elseif ($email && !isValidMailDomain($email)) { - $langs->load("errors"); - print img_warning($langs->trans("ErrorBadMXDomain", $email)); + if ($object->messtype != 'sms') { + print '
'; + print $form->editfieldkey("MailErrorsTo", 'email_errorsto', $object->email_errorsto, $object, $user->hasRight('mailing', 'creer') && $object->status < $object::STATUS_SENTCOMPLETELY, 'string'); + print ''; + print $form->editfieldval("MailErrorsTo", 'email_errorsto', $object->email_errorsto, $object, $user->hasRight('mailing', 'creer') && $object->status < $object::STATUS_SENTCOMPLETELY, 'string'); + $email = CMailFile::getValidAddress($object->email_errorsto, 2); + if ($email && !isValidEmail($email)) { + $langs->load("errors"); + print img_warning($langs->trans("ErrorBadEMail", $email)); + } elseif ($email && !isValidMailDomain($email)) { + $langs->load("errors"); + print img_warning($langs->trans("ErrorBadMXDomain", $email)); + } + print '
'; print ''; @@ -991,7 +1027,7 @@ if ($action == 'create') { print ''; // Number of distinct emails - print ''; @@ -1065,19 +1104,21 @@ if ($action == 'create') { if (GETPOST('cancel', 'alpha') || $confirm == 'no' || $action == '' || in_array($action, array('settodraft', 'valid', 'delete', 'sendall', 'clone', 'test', 'editevenunsubscribe'))) { print "\n\n
\n"; - if (($object->statut == 1) && ($user->hasRight('mailing', 'valider') || $object->user_validation_id == $user->id)) { + if (($object->status == 1) && ($user->hasRight('mailing', 'valider') || $object->user_validation_id == $user->id)) { print ''.$langs->trans("SetToDraft").''; } - if (($object->statut == 0 || $object->statut == 1 || $object->statut == 2) && $user->hasRight('mailing', 'creer')) { - if (isModEnabled('fckeditor') && getDolGlobalString('FCKEDITOR_ENABLE_MAILING')) { + if (($object->status == 0 || $object->status == 1 || $object->status == 2) && $user->hasRight('mailing', 'creer')) { + if (isModEnabled('fckeditor') && getDolGlobalString('FCKEDITOR_ENABLE_MAILING') && $object->messtype != 'sms') { print ''.$langs->trans("EditWithEditor").''; } else { - print ''.$langs->trans("EditWithTextEditor").''; + print ''.$langs->trans("EditWithTextEditor").''; } - if (!empty($conf->use_javascript_ajax)) { - print ''.$langs->trans("EditHTMLSource").''; + if (!getDolGlobalInt('EMAILINGS_SUPPORT_ALSO_SMS')) { + if (!empty($conf->use_javascript_ajax)) { + print ''.$langs->trans("EditHTMLSource").''; + } } } @@ -1089,17 +1130,17 @@ if ($action == 'create') { print ''.$langs->trans("TestMailing").''; } - if ($object->statut == 0) { + if ($object->status == 0) { if ($object->nbemail <= 0) { - print ''.$langs->trans("ValidMailing").''; + print ''.$langs->trans("Validate").''; } elseif (!$user->hasRight('mailing', 'valider')) { - print ''.$langs->trans("ValidMailing").''; + print ''.$langs->trans("Validate").''; } else { - print ''.$langs->trans("ValidMailing").''; + print ''.$langs->trans("Validate").''; } } - if (($object->statut == 1 || $object->statut == 2) && $object->nbemail > 0 && $user->hasRight('mailing', 'valider')) { + if (($object->status == 1 || $object->status == 2) && $object->nbemail > 0 && $user->hasRight('mailing', 'valider')) { if (getDolGlobalInt('MAILING_LIMIT_SENDBYWEB') < 0) { print ''.$langs->trans("SendMailing").''; } elseif (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !$user->hasRight('mailing', 'mailing_advance', 'send')) { @@ -1113,7 +1154,7 @@ if ($action == 'create') { print ''.$langs->trans("ToClone").''; } - if (($object->statut == 2 || $object->statut == 3) && $user->hasRight('mailing', 'valider')) { + if (($object->status == 2 || $object->status == 3) && $user->hasRight('mailing', 'valider')) { if (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !$user->hasRight('mailing', 'mailing_advance', 'send')) { print ''.$langs->trans("ResetMailing").''; } else { @@ -1121,11 +1162,11 @@ if ($action == 'create') { } } - if (($object->statut <= 1 && $user->hasRight('mailing', 'creer')) || $user->hasRight('mailing', 'supprimer')) { - if ($object->statut > 0 && (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !$user->hasRight('mailing', 'mailing_advance', 'delete'))) { - print ''.$langs->trans("DeleteMailing").''; + if (($object->status <= 1 && $user->hasRight('mailing', 'creer')) || $user->hasRight('mailing', 'supprimer')) { + if ($object->status > 0 && (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !$user->hasRight('mailing', 'mailing_advance', 'delete'))) { + print ''.$langs->trans("Delete").''; } else { - print ''.$langs->trans("DeleteMailing").''; + print ''.$langs->trans("Delete").''; } } @@ -1188,21 +1229,25 @@ if ($action == 'create') { print '
'; + print '
'; print $langs->trans("TotalNbOfDistinctRecipients"); print ''; $nbemail = ($object->nbemail ? $object->nbemail : 0); @@ -1018,21 +1054,24 @@ if ($action == 'create') { print '
'; print $langs->trans("MAIN_MAIL_SENDMODE"); print ''; - if (getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') && getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') != 'default') { - $text = $listofmethods[getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING')]; - } elseif (getDolGlobalString('MAIN_MAIL_SENDMODE')) { - $text = $listofmethods[getDolGlobalString('MAIN_MAIL_SENDMODE')]; - } else { - $text = $listofmethods['mail']; - } - print $text; - if (getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') != 'default') { - if (getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') != 'mail') { - print ' ('; - print getDolGlobalString('MAIN_MAIL_SMTP_SERVER_EMAILING', getDolGlobalString('MAIN_MAIL_SMTP_SERVER')); - print ')'; + if ($object->messtype != 'sms') { + if (getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') && getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') != 'default') { + $text = $listofmethods[getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING')]; + } elseif (getDolGlobalString('MAIN_MAIL_SENDMODE')) { + $text = $listofmethods[getDolGlobalString('MAIN_MAIL_SENDMODE')]; + } else { + $text = $listofmethods['mail']; } - } elseif (getDolGlobalString('MAIN_MAIL_SENDMODE') != 'mail' && getDolGlobalString('MAIN_MAIL_SMTP_SERVER')) { + print $text; + if (getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') != 'default') { + if (getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') != 'mail') { + print ' ('.getDolGlobalString('MAIN_MAIL_SMTP_SERVER_EMAILING').')'; + } + } elseif (getDolGlobalString('MAIN_MAIL_SENDMODE') != 'mail' && getDolGlobalString('MAIN_MAIL_SMTP_SERVER')) { + print ' ('.getDolGlobalString('MAIN_MAIL_SMTP_SERVER').')'; + } + } else { + print 'SMS '; print ' ('.getDolGlobalString('MAIN_MAIL_SMTP_SERVER').')'; } print '
'; // Subject - print ''; + if ($object->messtype != 'sms') { + print ''; + } // Joined files - print ''; } - print ''; // Background color /*print ''; + print ''; // To - print ''; + if ($object->messtype != 'sms') { + print ''; + } print '
'.$langs->trans("MailTopic").''.$object->sujet.'
'.$langs->trans("MailTopic").''.$object->sujet.'
'.$langs->trans("MailFile").''; - // List of files - $listofpaths = dol_dir_list($upload_dir, 'all', 0, '', '', 'name', SORT_ASC, 0); - if (count($listofpaths)) { - foreach ($listofpaths as $key => $val) { - print img_mime($listofpaths[$key]['name']).' '.$listofpaths[$key]['name']; - print '
'; + if ($object->messtype != 'sms') { + print '
'.$langs->trans("MailFile").''; + // List of files + $listofpaths = dol_dir_list($upload_dir, 'all', 0, '', '', 'name', SORT_ASC, 0); + if (count($listofpaths)) { + foreach ($listofpaths as $key => $val) { + print img_mime($listofpaths[$key]['name']).' '.$listofpaths[$key]['name']; + print '
'; + } + } else { + print ''.$langs->trans("NoAttachedFiles").'
'; } - } else { - print ''.$langs->trans("NoAttachedFiles").'
'; + print '
'.$langs->trans("BackgroundColorByDefault").''; @@ -1242,7 +1287,7 @@ if ($action == 'create') { $morehtmlright = ''; $nbtry = $nbok = 0; - if ($object->statut == 2 || $object->statut == 3) { + if ($object->status == 2 || $object->status == 3) { $nbtry = $object->countNbOfTargets('alreadysent'); $nbko = $object->countNbOfTargets('alreadysentko'); @@ -1269,9 +1314,13 @@ if ($action == 'create') { */ // From - print '
'.$langs->trans("MailFrom").''.dol_print_email($object->email_from, 0, 0, 0, 0, 1).'
'; + print $langs->trans("MailFrom"); + print ''.dol_print_email($object->email_from, 0, 0, 0, 0, 1).'
'.$langs->trans("MailErrorsTo").''.dol_print_email($object->email_errorsto, 0, 0, 0, 0, 1).'
'.$langs->trans("MailErrorsTo").''.dol_print_email($object->email_errorsto, 0, 0, 0, 0, 1).'
'; print ''; @@ -1289,7 +1338,7 @@ if ($action == 'create') { $nbemail = ($object->nbemail ? $object->nbemail : 0); if (is_numeric($nbemail)) { $text = ''; - if ((getDolGlobalString('MAILING_LIMIT_SENDBYWEB') && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail) && ($object->statut == 1 || $object->statut == 2)) { + if ((getDolGlobalString('MAILING_LIMIT_SENDBYWEB') && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail) && ($object->status == 1 || $object->status == 2)) { if (getDolGlobalInt('MAILING_LIMIT_SENDBYWEB') > 0) { $text .= $langs->trans('LimitSendingEmailing', getDolGlobalString('MAILING_LIMIT_SENDBYWEB')); } else { @@ -1366,54 +1415,60 @@ if ($action == 'create') { print ''; // Subject - print ''; + if ($object->messtype != 'sms') { + print ''; + } $trackid = ''; // TODO To avoid conflicts with 2 mass emailing, we should set a trackid here, even if we use another one into email header. dol_init_file_process($upload_dir, $trackid); // Joined files - $addfileaction = 'addfile'; - print ''; - print ''; + print ''; + // Add link to add file + $maxfilesizearray = getMaxFileSizeArray(); + $maxmin = $maxfilesizearray['maxmin']; + if ($maxmin > 0) { + $out .= ''; // MAX_FILE_SIZE must precede the field type=file + } + $out .= ''; + $out .= ' '; + $out .= ''; + print $out; + print ''; - // Background color - print ''; + // Background color + print ''; + } print '
'.$langs->trans("MailTopic").'
'; + print $langs->trans("MailTopic"); + print '
'.$langs->trans("MailFile").''; - // List of files - $listofpaths = dol_dir_list($upload_dir, 'all', 0, '', '', 'name', SORT_ASC, 0); + if ($object->messtype != 'sms') { + $addfileaction = 'addfile'; + print '
'.$langs->trans("MailFile").''; + // List of files + $listofpaths = dol_dir_list($upload_dir, 'all', 0, '', '', 'name', SORT_ASC, 0); - // TODO Trick to have param removedfile containing nb of image to delete. But this does not works without javascript - $out .= ''."\n"; - $out .= ''."\n"; - if (count($listofpaths)) { - foreach ($listofpaths as $key => $val) { - $out .= '
'; - $out .= img_mime($listofpaths[$key]['name']).' '.$listofpaths[$key]['name']; - $out .= ' '; - $out .= '
'; + // TODO Trick to have param removedfile containing nb of image to delete. But this does not works without javascript + $out .= ''."\n"; + $out .= ''."\n"; + if (count($listofpaths)) { + foreach ($listofpaths as $key => $val) { + $out .= '
'; + $out .= img_mime($listofpaths[$key]['name']).' '.$listofpaths[$key]['name']; + $out .= ' '; + $out .= '
'; + } + } else { + //$out .= ''.$langs->trans("NoAttachedFiles").'
'; } - } else { - //$out .= ''.$langs->trans("NoAttachedFiles").'
'; - } - // Add link to add file - $maxfilesizearray = getMaxFileSizeArray(); - $maxmin = $maxfilesizearray['maxmin']; - if ($maxmin > 0) { - $out .= ''; // MAX_FILE_SIZE must precede the field type=file - } - $out .= ''; - $out .= ' '; - $out .= ''; - print $out; - print '
'.$langs->trans("BackgroundColorByDefault").''; - print $htmlother->selectColor($object->bgcolor, 'bgcolor', '', 0); - print '
'.$langs->trans("BackgroundColorByDefault").''; + print $htmlother->selectColor($object->bgcolor, 'bgcolor', '', 0); + print '
'; @@ -1427,6 +1482,12 @@ if ($action == 'create') { $doleditor = new DolEditor('bodyemail', $object->body, '', 600, 'dolibarr_mailings', '', true, true, getDolGlobalInt('FCKEDITOR_ENABLE_MAILING'), 20, '90%'); $doleditor->Create(); } + if ($action == 'edittxt') { + // wysiwyg editor + require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + $doleditor = new DolEditor('bodyemail', $object->body, '', 600, 'dolibarr_mailings', '', true, true, 0, 20, '90%'); + $doleditor->Create(); + } if ($action == 'edithtml') { // HTML source editor require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index cd7593f8e21..4dac837e45b 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -129,6 +129,11 @@ if ($action == 'add' && $user->hasRight('mailing', 'creer')) { // Add recipient } } if ($result > 0) { + // If status of emailing is sent completely, change to to send partially + if ($object->status == $object::STATUS_SENTCOMPLETELY) { + $object->setStatut($object::STATUS_SENTPARTIALY); + } + setEventMessages($langs->trans("XTargetsAdded", $result), null, 'mesgs'); $action = ''; } @@ -275,7 +280,7 @@ if ($object->fetch($id) >= 0) { $morehtmlright = ''; $nbtry = $nbok = 0; - if ($object->statut == $object::STATUS_SENTPARTIALY || $object->statut == $object::STATUS_SENTCOMPLETELY) { + if ($object->status == $object::STATUS_SENTPARTIALY || $object->status == $object::STATUS_SENTCOMPLETELY) { $nbtry = $object->countNbOfTargets('alreadysent'); $nbko = $object->countNbOfTargets('alreadysentko'); $nbok = ($nbtry - $nbko); @@ -314,21 +319,23 @@ if ($object->fetch($id) >= 0) { print ''; // Errors to - print ''.$langs->trans("MailErrorsTo").''; - $emailarray = CMailFile::getArrayAddress($object->email_errorsto); - foreach ($emailarray as $email => $name) { - if ($name != $email) { - print dol_escape_htmltag($name).' <'.$email; - print '>'; - if (!isValidEmail($email)) { - $langs->load("errors"); - print img_warning($langs->trans("ErrorBadEMail", $email)); + if ($object->messtype != 'sms') { + print ''.$langs->trans("MailErrorsTo").''; + $emailarray = CMailFile::getArrayAddress($object->email_errorsto); + foreach ($emailarray as $email => $name) { + if ($name != $email) { + print dol_escape_htmltag($name).' <'.$email; + print '>'; + if (!isValidEmail($email)) { + $langs->load("errors"); + print img_warning($langs->trans("ErrorBadEMail", $email)); + } + } else { + print dol_print_email($object->email_errorsto, 0, 0, 0, 0, 1); } - } else { - print dol_print_email($object->email_errorsto, 0, 0, 0, 0, 1); } + print ''; } - print ''; print ''; print ''; @@ -340,13 +347,13 @@ if ($object->fetch($id) >= 0) { print ''; // Number of distinct emails - print ''; @@ -853,12 +875,12 @@ if ($object->fetch($id) >= 0) { if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; diff --git a/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php b/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php index 0cf26f4820b..70f7c9ba975 100644 --- a/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php +++ b/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php @@ -169,10 +169,10 @@ class FormAdvTargetEmailing extends Form if (getDolGlobalString('USER_HIDE_INACTIVE_IN_COMBOBOX')) { $sql_usr .= " AND u2.statut <> 0"; } - if (!empty($conf->global->USER_HIDE_NONEMPLOYEE_IN_COMBOBOX)) { + if (getDolGlobalString('USER_HIDE_NONEMPLOYEE_IN_COMBOBOX')) { $sql_usr .= " AND u2.employee<>0 "; } - if (!empty($conf->global->USER_HIDE_EXTERNAL_IN_COMBOBOX)) { + if (getDolGlobalString('USER_HIDE_EXTERNAL_IN_COMBOBOX')) { $sql_usr .= " AND u2.fk_soc IS NULL "; } $sql_usr .= " ORDER BY name ASC"; diff --git a/htdocs/comm/mailing/class/mailing.class.php b/htdocs/comm/mailing/class/mailing.class.php index e7058d81216..7e18ce5f477 100644 --- a/htdocs/comm/mailing/class/mailing.class.php +++ b/htdocs/comm/mailing/class/mailing.class.php @@ -46,6 +46,11 @@ class Mailing extends CommonObject */ public $picto = 'email'; + /** + * @var string Type of message ('email', 'sms') + */ + public $messtype; + /** * @var string title */ @@ -83,9 +88,15 @@ class Mailing extends CommonObject /** * @var int status + * @deprecated */ public $statut; // Status 0=Draft, 1=Validated, 2=Sent partially, 3=Sent completely + /** + * @var int status + */ + public $status; // Status 0=Draft, 1=Validated, 2=Sent partially, 3=Sent completely + /** * @var string email from */ @@ -126,47 +137,11 @@ class Mailing extends CommonObject */ public $joined_file4; - /** - * @var int id of user create - * @deprecated - */ - public $user_creation; - - /** - * @var int id of user create - * @deprecated - */ - public $user_creat; - - /** - * @var int id of user validate - * @deprecated - */ - public $user_validation; - - /** - * @var int id of user validate - * @deprecated - */ - public $user_valid; - - /** - * @var integer|string date_creation - * @deprecated - */ - public $date_creat; - /** * @var integer|string date_creation */ public $date_creation; - /** - * @var int date validate - * @deprecated - */ - public $date_valid; - /** * @var int date validate */ @@ -215,8 +190,6 @@ class Mailing extends CommonObject */ public function __construct($db) { - global $langs; - $this->db = $db; // List of language codes for status @@ -253,12 +226,13 @@ class Mailing extends CommonObject $this->email_from = trim($this->email_from); if (!$this->email_from) { - $this->error = $langs->trans("ErrorMailFromRequired"); + $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("From")); return -1; } $error = 0; $now = dol_now(); + $this->db->begin(); $sql = "INSERT INTO ".MAIN_DB_PREFIX."mailing"; @@ -270,6 +244,7 @@ class Mailing extends CommonObject } dol_syslog(__METHOD__, LOG_DEBUG); + $resql = $this->db->query($sql); if ($resql) { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."mailing"); @@ -323,6 +298,7 @@ class Mailing extends CommonObject $sql = "UPDATE ".MAIN_DB_PREFIX."mailing "; $sql .= " SET titre = '".$this->db->escape($this->title)."'"; + $sql .= ", messtype = '".$this->db->escape($this->messtype)."'"; $sql .= ", sujet = '".$this->db->escape($this->sujet)."'"; $sql .= ", body = '".$this->db->escape($this->body)."'"; $sql .= ", email_from = '".$this->db->escape($this->email_from)."'"; @@ -370,11 +346,9 @@ class Mailing extends CommonObject */ public function fetch($rowid, $ref = '') { - global $conf; - - $sql = "SELECT m.rowid, m.titre as title, m.sujet, m.body, m.bgcolor, m.bgimage, m.evenunsubscribe"; + $sql = "SELECT m.rowid, m.messtype, m.titre as title, m.sujet, m.body, m.bgcolor, m.bgimage, m.evenunsubscribe"; $sql .= ", m.email_from, m.email_replyto, m.email_errorsto"; - $sql .= ", m.statut, m.nbemail"; + $sql .= ", m.statut as status, m.nbemail"; $sql .= ", m.fk_user_creat, m.fk_user_valid"; $sql .= ", m.date_creat"; $sql .= ", m.date_valid"; @@ -396,9 +370,13 @@ class Mailing extends CommonObject $this->id = $obj->rowid; $this->ref = $obj->rowid; - $this->statut = $obj->statut; - $this->nbemail = $obj->nbemail; $this->title = $obj->title; + $this->messtype = $obj->messtype; + + $this->statut = $obj->status; // deprecated + $this->status = $obj->status; + + $this->nbemail = $obj->nbemail; $this->sujet = $obj->sujet; if (getDolGlobalString('FCKEDITOR_ENABLE_MAILING') && dol_textishtml(dol_html_entity_decode($obj->body, ENT_COMPAT | ENT_HTML5))) { @@ -418,14 +396,16 @@ class Mailing extends CommonObject $this->user_creation_id = $obj->fk_user_creat; $this->user_validation_id = $obj->fk_user_valid; - $this->date_creat = $this->db->jdate($obj->date_creat); $this->date_creation = $this->db->jdate($obj->date_creat); - $this->date_valid = $this->db->jdate($obj->date_valid); $this->date_validation = $this->db->jdate($obj->date_valid); $this->date_envoi = $this->db->jdate($obj->date_envoi); $this->extraparams = (array) json_decode($obj->extraparams, true); + if ($this->messtype == 'sms') { + $this->picto = 'phone'; + } + return 1; } else { dol_syslog(get_class($this)."::fetch Erreur -1"); @@ -460,6 +440,7 @@ class Mailing extends CommonObject // Load source object $object->fetch($fromid); $object->id = 0; + $object->status = 0; $object->statut = 0; // Clear fields @@ -482,9 +463,7 @@ class Mailing extends CommonObject $object->user_creation_id = $user->id; $object->user_validation_id = ''; - $object->date_creat = ''; - $object->date_valid = ''; - $object->date_envoi = ''; + $object->date_envoi = null; } // Create clone @@ -723,7 +702,8 @@ class Mailing extends CommonObject */ public function refreshNbOfTargets() { - $sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."mailing_cibles"; + $sql = "SELECT COUNT(rowid) as nb"; + $sql .= " FROM ".MAIN_DB_PREFIX."mailing_cibles"; $sql .= " WHERE fk_mailing = ".((int) $this->id); $resql = $this->db->query($sql); @@ -760,14 +740,14 @@ class Mailing extends CommonObject */ public function getTooltipContentArray($params) { - global $conf, $langs; + global $langs; - $nofetch = !empty($params['nofetch']); + //$nofetch = !empty($params['nofetch']); $langs->load('mails'); $datas = array(); $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("ShowEMailing").''; - if (isset($this->statut)) { + if (isset($this->status)) { $datas['picto'] .= ' '.$this->getLibStatut(5); } $datas['ref'] = '
'.$langs->trans('Ref').': '.$this->ref; @@ -876,7 +856,7 @@ class Mailing extends CommonObject */ public function getLibStatut($mode = 0) { - return $this->LibStatut($this->statut, $mode); + return $this->LibStatut($this->status, $mode); } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps diff --git a/htdocs/comm/mailing/index.php b/htdocs/comm/mailing/index.php index 7aabd8dc2e3..8fee4a7935f 100644 --- a/htdocs/comm/mailing/index.php +++ b/htdocs/comm/mailing/index.php @@ -152,7 +152,7 @@ print '
'; * List of last emailings */ $limit = 10; -$sql = "SELECT m.rowid, m.titre as title, m.nbemail, m.statut as status, m.date_creat"; +$sql = "SELECT m.rowid, m.titre as title, m.nbemail, m.statut as status, m.date_creat, m.messtype"; $sql .= " FROM ".MAIN_DB_PREFIX."mailing as m"; $sql .= " WHERE m.entity = ".$conf->entity; $sql .= " ORDER BY m.date_creat DESC"; @@ -163,9 +163,18 @@ if ($result) { print '
'; + print '
'; print $langs->trans("TotalNbOfDistinctRecipients"); print ''; $nbemail = ($object->nbemail ? $object->nbemail : 0); if (is_numeric($nbemail)) { $text = ''; - if ((getDolGlobalString('MAILING_LIMIT_SENDBYWEB') && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail) && ($object->statut == 1 || ($object->statut == 2 && $nbtry < $nbemail))) { + if ((getDolGlobalString('MAILING_LIMIT_SENDBYWEB') && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail) && ($object->status == 1 || ($object->status == 2 && $nbtry < $nbemail))) { if (getDolGlobalInt('MAILING_LIMIT_SENDBYWEB') > 0) { $text .= $langs->trans('LimitSendingEmailing', getDolGlobalString('MAILING_LIMIT_SENDBYWEB')); } else { @@ -398,7 +405,14 @@ if ($object->fetch($id) >= 0) { print '
'; - $allowaddtarget = ($object->statut == $object::STATUS_DRAFT); + $newcardbutton = ''; + $allowaddtarget = ($object->status == $object::STATUS_DRAFT); + if (GETPOST('allowaddtarget')) { + $allowaddtarget = 1; + } + if (!$allowaddtarget) { + $newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', $_SERVER["PHP_SELF"].'?id='.$object->id.'&allowaddtarget=1', '', $user->hasRight('mailing', 'creer')); + } // Show email selectors if ($allowaddtarget && $user->hasRight('mailing', 'creer')) { @@ -410,11 +424,19 @@ if ($object->fetch($id) >= 0) { print '
'; print '
'; print '
'.$langs->trans("RecipientSelectionModules").'
'; - print '
'.$langs->trans("NbOfUniqueEMails").'
'; - print '
'.$langs->trans("Filters").'
'; - print '              
'.$langs->trans("EvenUnsubscribe").' '; - print ajax_object_onoff($object, 'evenunsubscribe', 'evenunsubscribe', 'EvenUnsubscribe:switch_on:warning', 'EvenUnsubscribe', array(), 'small valignmiddle', '', 1); + print '
'; + if ($object->messtype != 'sms') { + print $langs->trans("NbOfUniqueEMails"); + } else { + print $langs->trans("NbOfUniquePhones"); + } print '
'; + print '
'.$langs->trans("Filters").'
'; + if ($object->messtype != 'sms') { + print '              
'.$langs->trans("EvenUnsubscribe").' '; + print ajax_object_onoff($object, 'evenunsubscribe', 'evenunsubscribe', 'EvenUnsubscribe:switch_on:warning', 'EvenUnsubscribe', array(), 'small valignmiddle', '', 1); + print '
'; + } print '
'; print '
 
'; print '
'; // End tr @@ -648,14 +670,14 @@ if ($object->fetch($id) >= 0) { print ''; $morehtmlcenter = ''; - if ($allowaddtarget) { + if ($object->status == $object::STATUS_DRAFT) { $morehtmlcenter = ''.$langs->trans("ToClearAllRecipientsClickHere").' id.'" class="button reposition smallpaddingimp">'.$langs->trans("TargetsReset").''; } $morehtmlcenter .= '   id.'">'.img_picto('', 'download', 'class="pictofixedwidth"').$langs->trans("Download").''; $massactionbutton = ''; - print_barre_liste($langs->trans("MailSelectedRecipients"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $morehtmlcenter, $num, $nbtotalofrecords, 'generic', 0, '', '', $limit, 0, 0, 1); + print_barre_liste($langs->trans("MailSelectedRecipients"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $morehtmlcenter, $num, $nbtotalofrecords, 'generic', 0, $newcardbutton, '', $limit, 0, 0, 1); print ''; @@ -776,12 +798,12 @@ if ($object->fetch($id) >= 0) { if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print '
'; print ''; - if ($obj->statut == $object::STATUS_DRAFT) { // Not sent yet + if ($obj->status == $object::STATUS_DRAFT) { // Not sent yet if ($user->hasRight('mailing', 'creer')) { print ''.img_delete($langs->trans("RemoveRecipient")).''; } } - /*if ($obj->statut == -1) // Sent with error + /*if ($obj->status == -1) // Sent with error { print ''.$langs->trans("Retry").''; }*/ @@ -834,7 +856,7 @@ if ($object->fetch($id) >= 0) { // Date sent print ''; - if ($obj->statut != $object::STATUS_DRAFT) { + if ($obj->status != $object::STATUS_DRAFT) { // Date sent print $obj->date_envoi; } @@ -842,10 +864,10 @@ if ($object->fetch($id) >= 0) { // Status of recipient sending email (Warning != status of emailing) print ''; - if ($obj->statut == $object::STATUS_DRAFT) { - print $object::libStatutDest($obj->statut, 2, ''); + if ($obj->status == $object::STATUS_DRAFT) { + print $object::libStatutDest($obj->status, 2, ''); } else { - print $object::libStatutDest($obj->statut, 2, $obj->error_text); + print $object::libStatutDest($obj->status, 2, $obj->error_text); } print ''; print ''; - if ($obj->statut == $object::STATUS_DRAFT) { // Not sent yet + if ($obj->status == $object::STATUS_DRAFT) { // Not sent yet if ($user->hasRight('mailing', 'creer')) { print ''.img_delete($langs->trans("RemoveRecipient")).''; } } - /*if ($obj->statut == -1) // Sent with error + /*if ($obj->status == -1) // Sent with error { print ''.$langs->trans("Retry").''; }*/ @@ -869,7 +891,7 @@ if ($object->fetch($id) >= 0) { $i++; } } else { - if ($object->statut < $object::STATUS_SENTPARTIALY) { + if ($object->status < $object::STATUS_SENTPARTIALY) { print '
'; print ''.$langs->trans("NoTargetYet").''; print '
'; print ''; print ''; + if (getDolGlobalInt('EMAILINGS_SUPPORT_ALSO_SMS')) { + print ''; + } print ''; - print ''; - print ''; + print ''; + print ''; + print ''; $num = $db->num_rows($result); if ($num > 0) { @@ -176,12 +185,16 @@ if ($result) { $mailstatic = new Mailing($db); $mailstatic->id = $obj->rowid; $mailstatic->ref = $obj->rowid; + $mailstatic->messtype = $obj->messtype; print ''; print ''; - print ''; + print ''; + if (getDolGlobalInt('EMAILINGS_SUPPORT_ALSO_SMS')) { + print ''; + } print ''; - print ''; + print ''; print ''; print ''; $i++; diff --git a/htdocs/comm/mailing/info.php b/htdocs/comm/mailing/info.php index dccea76c39b..12ca330896b 100644 --- a/htdocs/comm/mailing/info.php +++ b/htdocs/comm/mailing/info.php @@ -66,7 +66,7 @@ if ($object->fetch($id) >= 0) { $morehtmlright = ''; $nbtry = $nbok = 0; - if ($object->statut == 2 || $object->statut == 3) { + if ($object->status == 2 || $object->status == 3) { $nbtry = $object->countNbOfTargets('alreadysent'); $nbko = $object->countNbOfTargets('alreadysentko'); diff --git a/htdocs/comm/mailing/list.php b/htdocs/comm/mailing/list.php index 973480ca2e6..e60e2295add 100644 --- a/htdocs/comm/mailing/list.php +++ b/htdocs/comm/mailing/list.php @@ -57,6 +57,7 @@ $pagenext = $page + 1; // Search Fields $search_all = trim((GETPOST('search_all', 'alphanohtml') != '') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml')); $search_ref = GETPOST("search_ref", "alpha") ? GETPOST("search_ref", "alpha") : GETPOST("sref", "alpha"); +$search_messtype = GETPOST("search_messtype", "alpha"); $filteremail = GETPOST('filteremail', 'alpha'); // Initialize technical objects @@ -122,6 +123,7 @@ if (empty($reshook)) { $search[$key]=''; }*/ $search_ref = ''; + $search_messtype = ''; $search_all = ''; $toselect = array(); $search_array_options = array(); @@ -155,7 +157,7 @@ $morecss = array(); // Build and execute select // -------------------------------------------------------------------- if ($filteremail) { - $sql = "SELECT m.rowid, m.titre as title, m.nbemail, m.statut, m.date_creat as datec, m.date_envoi as date_envoi,"; + $sql = "SELECT m.rowid, m.messtype, m.titre as title, m.nbemail, m.statut as status, m.date_creat as datec, m.date_envoi as date_envoi,"; $sql .= " mc.statut as sendstatut"; $sqlfields = $sql; // $sql fields to remove for count total @@ -166,8 +168,11 @@ if ($filteremail) { if ($search_ref) { $sql .= " AND m.rowid = '".$db->escape($search_ref)."'"; } + if ($search_messtype) { + $sql .= " AND m.messtype LIKE '".$db->escape($search_messtype)."'"; + } if ($search_all) { - $sql .= " AND (m.titre like '%".$db->escape($search_all)."%' OR m.sujet like '%".$db->escape($search_all)."%' OR m.body like '%".$db->escape($search_all)."%')"; + $sql .= " AND (m.titre LIKE '%".$db->escape($search_all)."%' OR m.sujet LIKE '%".$db->escape($search_all)."%' OR m.body LIKE '%".$db->escape($search_all)."%')"; } if (!$sortorder) { $sortorder = "ASC"; @@ -176,17 +181,20 @@ if ($filteremail) { $sortfield = "m.rowid"; } } else { - $sql = "SELECT m.rowid, m.titre as title, m.nbemail, m.statut, m.date_creat as datec, m.date_envoi as date_envoi"; + $sql = "SELECT m.rowid, m.messtype, m.titre as title, m.nbemail, m.statut as status, m.date_creat as datec, m.date_envoi as date_envoi"; $sqlfields = $sql; // $sql fields to remove for count total $sql .= " FROM ".MAIN_DB_PREFIX."mailing as m"; - $sql .= " WHERE m.entity = ".$conf->entity; + $sql .= " WHERE m.entity = ".((int) $conf->entity); if ($search_ref) { $sql .= " AND m.rowid = '".$db->escape($search_ref)."'"; } + if ($search_messtype) { + $sql .= " AND m.messtype LIKE '".$db->escape($search_messtype)."'"; + } if ($search_all) { - $sql .= " AND (m.titre like '%".$db->escape($search_all)."%' OR m.sujet like '%".$db->escape($search_all)."%' OR m.body like '%".$db->escape($search_all)."%')"; + $sql .= " AND (m.titre LIKE '%".$db->escape($search_all)."%' OR m.sujet LIKE '%".$db->escape($search_all)."%' OR m.body LIKE '%".$db->escape($search_all)."%')"; } if (!$sortorder) { $sortorder = "ASC"; @@ -276,6 +284,16 @@ if ($limit > 0 && $limit != $conf->liste_limit) { if ($optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); } +if ($search_ref != '') { + $param .= '&search_ref='.urlencode($search_ref); +} +if ($search_messtype != '') { + $param .= '&search_type='.urlencode($search_messtype); +} +if ($optioncss != '') { + $param .= '&optioncss='.urlencode($optioncss); +} + if ($filteremail) { $param .= '&filteremail='.urlencode($filteremail); } @@ -378,6 +396,12 @@ if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; +// Message type +if (getDolGlobalInt('EMAILINGS_SUPPORT_ALSO_SMS')) { + print ''; +} // Title print ''; + // Message type + if (getDolGlobalInt('EMAILINGS_SUPPORT_ALSO_SMS')) { + print ''; + } + // Title print ''; @@ -500,7 +541,7 @@ while ($i < $imaxinloop) { if (!$filteremail) { print ''; + print ''; print ''; // Status @@ -522,7 +563,7 @@ while ($i < $imaxinloop) { if ($filteremail) { print $object::libStatutDest($obj->sendstatut, 2); } else { - print $object->LibStatut($obj->statut, 5); + print $object->LibStatut($obj->status, 5); } print ''; diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 408d13837ab..cfc18095d6d 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -119,11 +119,11 @@ $usercanread = $user->hasRight("propal", "lire"); $usercancreate = $user->hasRight("propal", "creer"); $usercandelete = $user->hasRight("propal", "supprimer"); -$usercanclose = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $usercancreate) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !empty($user->rights->propal->propal_advance->close))); -$usercanvalidate = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $usercancreate) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !empty($user->rights->propal->propal_advance->validate))); -$usercansend = (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !empty($user->rights->propal->propal_advance->send))); +$usercanclose = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $usercancreate) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('propal', 'propal_advance', 'close'))); +$usercanvalidate = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $usercancreate) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('propal', 'propal_advance', 'validate'))); +$usercansend = (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('propal', 'propal_advance', 'send'))); -$usermustrespectpricemin = ((getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && empty($user->rights->produit->ignore_price_min_advance)) || !getDolGlobalString('MAIN_USE_ADVANCED_PERMS')); +$usermustrespectpricemin = ((getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !$user->hasRight('produit', 'ignore_price_min_advance')) || !getDolGlobalString('MAIN_USE_ADVANCED_PERMS')); $usercancreateorder = $user->hasRight('commande', 'creer'); $usercancreateinvoice = $user->hasRight('facture', 'creer'); $usercancreatecontract = $user->hasRight('contrat', 'creer'); diff --git a/htdocs/comm/propal/class/api_proposals.class.php b/htdocs/comm/propal/class/api_proposals.class.php index 762027e1475..aa1e3d0e980 100644 --- a/htdocs/comm/propal/class/api_proposals.class.php +++ b/htdocs/comm/propal/class/api_proposals.class.php @@ -174,7 +174,7 @@ class Proposals extends DolibarrApi // If the internal user must only see his customers, force searching by him $search_sale = 0; - if (!DolibarrApiAccess::$user->rights->hasRight('societe', 'client', 'voir') && !$socids) { + if (!DolibarrApiAccess::$user->hasRight('societe', 'client', 'voir') && !$socids) { $search_sale = DolibarrApiAccess::$user->id; } @@ -247,7 +247,7 @@ class Proposals extends DolibarrApi */ public function post($request_data = null) { - if (!DolibarrApiAccess::$user->rights->propal->creer) { + if (!DolibarrApiAccess::$user->hasRight('propal', 'creer')) { throw new RestException(401, "Insuffisant rights"); } // Check mandatory fields @@ -330,7 +330,7 @@ class Proposals extends DolibarrApi */ public function postLine($id, $request_data = null) { - if (!DolibarrApiAccess::$user->rights->propal->creer) { + if (!DolibarrApiAccess::$user->hasRight('propal', 'creer')) { throw new RestException(403); } @@ -396,7 +396,7 @@ class Proposals extends DolibarrApi */ public function postLines($id, $request_data = null) { - if (!DolibarrApiAccess::$user->rights->propal->creer) { + if (!DolibarrApiAccess::$user->hasRight('propal', 'creer')) { throw new RestException(403); } @@ -476,7 +476,7 @@ class Proposals extends DolibarrApi */ public function putLine($id, $lineid, $request_data = null) { - if (!DolibarrApiAccess::$user->rights->propal->creer) { + if (!DolibarrApiAccess::$user->hasRight('propal', 'creer')) { throw new RestException(403); } @@ -554,7 +554,7 @@ class Proposals extends DolibarrApi */ public function deleteLine($id, $lineid) { - if (!DolibarrApiAccess::$user->rights->propal->creer) { + if (!DolibarrApiAccess::$user->hasRight('propal', 'creer')) { throw new RestException(403); } @@ -590,7 +590,7 @@ class Proposals extends DolibarrApi */ public function postContact($id, $contactid, $type) { - if (!DolibarrApiAccess::$user->rights->propal->creer) { + if (!DolibarrApiAccess::$user->hasRight('propal', 'creer')) { throw new RestException(403); } @@ -638,7 +638,7 @@ class Proposals extends DolibarrApi */ public function deleteContact($id, $contactid, $type) { - if (!DolibarrApiAccess::$user->rights->propal->creer) { + if (!DolibarrApiAccess::$user->hasRight('propal', 'creer')) { throw new RestException(403); } @@ -676,7 +676,7 @@ class Proposals extends DolibarrApi */ public function put($id, $request_data = null) { - if (!DolibarrApiAccess::$user->rights->propal->creer) { + if (!DolibarrApiAccess::$user->hasRight('propal', 'creer')) { throw new RestException(403); } @@ -726,7 +726,7 @@ class Proposals extends DolibarrApi */ public function delete($id) { - if (!DolibarrApiAccess::$user->rights->propal->supprimer) { + if (!DolibarrApiAccess::$user->hasRight('propal', 'supprimer')) { throw new RestException(403); } $result = $this->propal->fetch($id); @@ -760,7 +760,7 @@ class Proposals extends DolibarrApi */ public function settodraft($id) { - if (!DolibarrApiAccess::$user->rights->propal->creer) { + if (!DolibarrApiAccess::$user->hasRight('propal', 'creer')) { throw new RestException(403); } $result = $this->propal->fetch($id); @@ -816,7 +816,7 @@ class Proposals extends DolibarrApi */ public function validate($id, $notrigger = 0) { - if (!DolibarrApiAccess::$user->rights->propal->creer) { + if (!DolibarrApiAccess::$user->hasRight('propal', 'creer')) { throw new RestException(403); } $result = $this->propal->fetch($id); @@ -863,7 +863,7 @@ class Proposals extends DolibarrApi */ public function close($id, $status, $note_private = '', $notrigger = 0) { - if (!DolibarrApiAccess::$user->rights->propal->creer) { + if (!DolibarrApiAccess::$user->hasRight('propal', 'creer')) { throw new RestException(403); } $result = $this->propal->fetch($id); @@ -907,7 +907,7 @@ class Proposals extends DolibarrApi */ public function setinvoiced($id) { - if (!DolibarrApiAccess::$user->rights->propal->creer) { + if (!DolibarrApiAccess::$user->hasRight('propal', 'creer')) { throw new RestException(403); } $result = $this->propal->fetch($id); diff --git a/htdocs/comm/propal/document.php b/htdocs/comm/propal/document.php index 9c83eafad02..00ec2367c8a 100644 --- a/htdocs/comm/propal/document.php +++ b/htdocs/comm/propal/document.php @@ -74,7 +74,7 @@ if (!$sortfield) { $object = new Propal($db); $object->fetch($id, $ref); -$permissiontoadd = $user->rights->propal->creer; +$permissiontoadd = $user->hasRight('propal', 'creer'); // Security check $socid = ''; @@ -174,8 +174,8 @@ if ($object->id > 0) { print dol_get_fiche_end(); $modulepart = 'propal'; - $permissiontoadd = $user->rights->propal->creer; - $permtoedit = $user->rights->propal->creer; + $permissiontoadd = $user->hasRight('propal', 'creer'); + $permtoedit = $user->hasRight('propal', 'creer'); $param = '&id='.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } else { diff --git a/htdocs/comm/propal/note.php b/htdocs/comm/propal/note.php index 36eb458f252..bc408a1c6de 100644 --- a/htdocs/comm/propal/note.php +++ b/htdocs/comm/propal/note.php @@ -66,7 +66,7 @@ $usercancreate = $user->hasRight("propal", "creer"); * Actions */ -$permissionnote = $user->rights->propal->creer; // Used by the include of actions_setnotes.inc.php +$permissionnote = $user->hasRight('propal', 'creer'); // Used by the include of actions_setnotes.inc.php $parameters = array(); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks diff --git a/htdocs/comm/remx.php b/htdocs/comm/remx.php index 3d7e1d5e3db..068fdff9052 100644 --- a/htdocs/comm/remx.php +++ b/htdocs/comm/remx.php @@ -69,9 +69,6 @@ if (GETPOST('cancel', 'alpha') && !empty($backtopage)) { } if ($action == 'confirm_split' && GETPOST("confirm", "alpha") == 'yes' && $permissiontocreate) { - //if ($user->rights->societe->creer) - //if ($user->hasRight('facture', 'creer')) - $amount_ttc_1 = GETPOST('amount_ttc_1', 'alpha'); $amount_ttc_1 = price2num($amount_ttc_1); $amount_ttc_2 = GETPOST('amount_ttc_2', 'alpha'); @@ -160,9 +157,6 @@ if ($action == 'confirm_split' && GETPOST("confirm", "alpha") == 'yes' && $permi } if ($action == 'setremise' && $permissiontocreate) { - //if ($user->rights->societe->creer) - //if ($user->hasRight('facture', 'creer')) - $amount = price2num(GETPOST('amount', 'alpha'), '', 2); $desc = GETPOST('desc', 'alpha'); $tva_tx = GETPOST('tva_tx', 'alpha'); @@ -200,9 +194,6 @@ if ($action == 'setremise' && $permissiontocreate) { } if (GETPOST('action', 'aZ09') == 'confirm_remove' && GETPOST("confirm") == 'yes' && $permissiontocreate) { - //if ($user->rights->societe->creer) - //if ($user->hasRight('facture', 'creer')) - $db->begin(); $discount = new DiscountAbsolute($db); diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index f3881a10aff..236a4675187 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -129,7 +129,7 @@ $usercancancel = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user $usercansend = (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') || $user->hasRight('commande', 'order_advance', 'send')); $usercangeneretedoc = (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') || $user->hasRight('commande', 'order_advance', 'generetedoc')); -$usermustrespectpricemin = ((getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && empty($user->rights->produit->ignore_price_min_advance)) || !getDolGlobalString('MAIN_USE_ADVANCED_PERMS')); +$usermustrespectpricemin = ((getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !$user->hasRight('produit', 'ignore_price_min_advance')) || !getDolGlobalString('MAIN_USE_ADVANCED_PERMS')); $usercancreatepurchaseorder = ($user->hasRight('fournisseur', 'commande', 'creer') || $user->hasRight('supplier_order', 'creer')); $permissionnote = $usercancreate; // Used by the include of actions_setnotes.inc.php diff --git a/htdocs/commande/class/api_orders.class.php b/htdocs/commande/class/api_orders.class.php index 2e6ed740f7c..d70dab85cb7 100644 --- a/htdocs/commande/class/api_orders.class.php +++ b/htdocs/commande/class/api_orders.class.php @@ -176,7 +176,7 @@ class Orders extends DolibarrApi // If the internal user must only see his customers, force searching by him $search_sale = 0; - if (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) { + if (!DolibarrApiAccess::$user->hasRight('societe', 'client', 'voir') && !$socids) { $search_sale = DolibarrApiAccess::$user->id; } @@ -264,7 +264,7 @@ class Orders extends DolibarrApi */ public function post($request_data = null) { - if (!DolibarrApiAccess::$user->rights->commande->creer) { + if (!DolibarrApiAccess::$user->hasRight('commande', 'creer')) { throw new RestException(401, "Insuffisant rights"); } // Check mandatory fields @@ -337,7 +337,7 @@ class Orders extends DolibarrApi */ public function postLine($id, $request_data = null) { - if (!DolibarrApiAccess::$user->rights->commande->creer) { + if (!DolibarrApiAccess::$user->hasRight('commande', 'creer')) { throw new RestException(403); } @@ -404,7 +404,7 @@ class Orders extends DolibarrApi */ public function putLine($id, $lineid, $request_data = null) { - if (!DolibarrApiAccess::$user->rights->commande->creer) { + if (!DolibarrApiAccess::$user->hasRight('commande', 'creer')) { throw new RestException(403); } @@ -472,7 +472,7 @@ class Orders extends DolibarrApi */ public function deleteLine($id, $lineid) { - if (!DolibarrApiAccess::$user->rights->commande->creer) { + if (!DolibarrApiAccess::$user->hasRight('commande', 'creer')) { throw new RestException(403); } @@ -541,7 +541,7 @@ class Orders extends DolibarrApi */ public function postContact($id, $contactid, $type) { - if (!DolibarrApiAccess::$user->rights->commande->creer) { + if (!DolibarrApiAccess::$user->hasRight('commande', 'creer')) { throw new RestException(403); } @@ -589,7 +589,7 @@ class Orders extends DolibarrApi */ public function deleteContact($id, $contactid, $type) { - if (!DolibarrApiAccess::$user->rights->commande->creer) { + if (!DolibarrApiAccess::$user->hasRight('commande', 'creer')) { throw new RestException(403); } @@ -631,7 +631,7 @@ class Orders extends DolibarrApi */ public function put($id, $request_data = null) { - if (!DolibarrApiAccess::$user->rights->commande->creer) { + if (!DolibarrApiAccess::$user->hasRight('commande', 'creer')) { throw new RestException(403); } @@ -678,7 +678,7 @@ class Orders extends DolibarrApi */ public function delete($id) { - if (!DolibarrApiAccess::$user->rights->commande->supprimer) { + if (!DolibarrApiAccess::$user->hasRight('commande', 'supprimer')) { throw new RestException(403); } $result = $this->commande->fetch($id); @@ -726,7 +726,7 @@ class Orders extends DolibarrApi */ public function validate($id, $idwarehouse = 0, $notrigger = 0) { - if (!DolibarrApiAccess::$user->rights->commande->creer) { + if (!DolibarrApiAccess::$user->hasRight('commande', 'creer')) { throw new RestException(403); } $result = $this->commande->fetch($id); @@ -777,7 +777,7 @@ class Orders extends DolibarrApi */ public function reopen($id) { - if (!DolibarrApiAccess::$user->rights->commande->creer) { + if (!DolibarrApiAccess::$user->hasRight('commande', 'creer')) { throw new RestException(403); } if (empty($id)) { @@ -813,7 +813,7 @@ class Orders extends DolibarrApi */ public function setinvoiced($id) { - if (!DolibarrApiAccess::$user->rights->commande->creer) { + if (!DolibarrApiAccess::$user->hasRight('commande', 'creer')) { throw new RestException(403); } if (empty($id)) { @@ -854,7 +854,7 @@ class Orders extends DolibarrApi */ public function close($id, $notrigger = 0) { - if (!DolibarrApiAccess::$user->rights->commande->creer) { + if (!DolibarrApiAccess::$user->hasRight('commande', 'creer')) { throw new RestException(403); } $result = $this->commande->fetch($id); @@ -899,7 +899,7 @@ class Orders extends DolibarrApi */ public function settodraft($id, $idwarehouse = -1) { - if (!DolibarrApiAccess::$user->rights->commande->creer) { + if (!DolibarrApiAccess::$user->hasRight('commande', 'creer')) { throw new RestException(403); } $result = $this->commande->fetch($id); @@ -954,7 +954,7 @@ class Orders extends DolibarrApi if (!DolibarrApiAccess::$user->hasRight('propal', 'lire')) { throw new RestException(403); } - if (!DolibarrApiAccess::$user->rights->commande->creer) { + if (!DolibarrApiAccess::$user->hasRight('commande', 'creer')) { throw new RestException(403); } if (empty($proposalid)) { @@ -992,7 +992,7 @@ class Orders extends DolibarrApi public function getOrderShipments($id) { require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php'; - if (!DolibarrApiAccess::$user->rights->expedition->lire) { + if (!DolibarrApiAccess::$user->hasRight('expedition', 'lire')) { throw new RestException(403); } $obj_ret = array(); @@ -1048,7 +1048,7 @@ class Orders extends DolibarrApi public function createOrderShipment($id, $warehouse_id) { require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php'; - if (!DolibarrApiAccess::$user->rights->expedition->creer) { + if (!DolibarrApiAccess::$user->hasRight('expedition', 'creer')) { throw new RestException(403); } if ($warehouse_id <= 0) { diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index dc4df918c7b..a5b1446524c 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -776,8 +776,8 @@ class Commande extends CommonOrder $error = 0; - $usercanclose = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !empty($user->rights->commande->creer)) - || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !empty($user->rights->commande->order_advance->close))); + $usercanclose = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('commande', 'creer')) + || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('commande', 'order_advance', 'close'))); if ($usercanclose) { if ($this->statut == self::STATUS_CLOSED) { diff --git a/htdocs/commande/document.php b/htdocs/commande/document.php index c529cade054..864375fbf5d 100644 --- a/htdocs/commande/document.php +++ b/htdocs/commande/document.php @@ -179,8 +179,8 @@ if ($id > 0 || !empty($ref)) { print dol_get_fiche_end(); $modulepart = 'commande'; - $permissiontoadd = $user->rights->commande->creer; - $permtoedit = $user->rights->commande->creer; + $permissiontoadd = $user->hasRight('commande', 'creer'); + $permtoedit = $user->hasRight('commande', 'creer'); $param = '&id='.$object->id.'&entity='.(empty($object->entity) ? $conf->entity : $object->entity); include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } else { diff --git a/htdocs/commande/note.php b/htdocs/commande/note.php index 368a8333317..33fd5fd60e3 100644 --- a/htdocs/commande/note.php +++ b/htdocs/commande/note.php @@ -54,7 +54,7 @@ $result = restrictedArea($user, 'commande', $id, ''); $usercancreate = $user->hasRight("commande", "creer"); -$permissionnote = $user->rights->commande->creer; // Used by the include of actions_setnotes.inc.php +$permissionnote = $user->hasRight('commande', 'creer'); // Used by the include of actions_setnotes.inc.php $object = new Commande($db); diff --git a/htdocs/compta/accounting-files.php b/htdocs/compta/accounting-files.php index e7679dcec72..dd4a6c50c75 100644 --- a/htdocs/compta/accounting-files.php +++ b/htdocs/compta/accounting-files.php @@ -136,13 +136,13 @@ $error = 0; $listofchoices = array( 'selectinvoices'=>array('label'=>'Invoices', 'picto'=>'bill', 'lang'=>'bills', 'enabled' => isModEnabled('facture'), 'perms' => $user->hasRight('facture', 'lire')), - 'selectsupplierinvoices'=>array('label'=>'BillsSuppliers', 'picto'=>'supplier_invoice', 'lang'=>'bills', 'enabled' => isModEnabled('supplier_invoice'), 'perms' => !empty($user->rights->fournisseur->facture->lire)), - 'selectexpensereports'=>array('label'=>'ExpenseReports', 'picto'=>'expensereport', 'lang'=>'trips', 'enabled' => isModEnabled('expensereport'), 'perms' => !empty($user->rights->expensereport->lire)), - 'selectdonations'=>array('label'=>'Donations', 'picto'=>'donation', 'lang'=>'donation', 'enabled' => isModEnabled('don'), 'perms' => !empty($user->rights->don->lire)), - 'selectsocialcontributions'=>array('label'=>'SocialContributions', 'picto'=>'bill', 'enabled' => isModEnabled('tax'), 'perms' => !empty($user->rights->tax->charges->lire)), - 'selectpaymentsofsalaries'=>array('label'=>'SalariesPayments', 'picto'=>'salary', 'lang'=>'salaries', 'enabled' => isModEnabled('salaries'), 'perms' => !empty($user->rights->salaries->read)), - 'selectvariouspayment'=>array('label'=>'VariousPayment', 'picto'=>'payment', 'enabled' => isModEnabled('banque'), 'perms' => !empty($user->rights->banque->lire)), - 'selectloanspayment'=>array('label'=>'PaymentLoan','picto'=>'loan', 'enabled' => isModEnabled('don'), 'perms' => !empty($user->rights->loan->read)), + 'selectsupplierinvoices'=>array('label'=>'BillsSuppliers', 'picto'=>'supplier_invoice', 'lang'=>'bills', 'enabled' => isModEnabled('supplier_invoice'), 'perms' => $user->hasRight('fournisseur', 'facture', 'lire')), + 'selectexpensereports'=>array('label'=>'ExpenseReports', 'picto'=>'expensereport', 'lang'=>'trips', 'enabled' => isModEnabled('expensereport'), 'perms' => $user->hasRight('expensereport', 'lire')), + 'selectdonations'=>array('label'=>'Donations', 'picto'=>'donation', 'lang'=>'donation', 'enabled' => isModEnabled('don'), 'perms' => $user->hasRight('don', 'lire')), + 'selectsocialcontributions'=>array('label'=>'SocialContributions', 'picto'=>'bill', 'enabled' => isModEnabled('tax'), 'perms' => $user->hasRight('tax', 'charges', 'lire')), + 'selectpaymentsofsalaries'=>array('label'=>'SalariesPayments', 'picto'=>'salary', 'lang'=>'salaries', 'enabled' => isModEnabled('salaries'), 'perms' => $user->hasRight('salaries', 'read')), + 'selectvariouspayment'=>array('label'=>'VariousPayment', 'picto'=>'payment', 'enabled' => isModEnabled('banque'), 'perms' => $user->hasRight('banque', 'lire')), + 'selectloanspayment'=>array('label'=>'PaymentLoan','picto'=>'loan', 'enabled' => isModEnabled('don'), 'perms' => $user->hasRight('loan', 'read')), ); diff --git a/htdocs/compta/bank/account_statement_document.php b/htdocs/compta/bank/account_statement_document.php index a07759ad504..bd210826e37 100644 --- a/htdocs/compta/bank/account_statement_document.php +++ b/htdocs/compta/bank/account_statement_document.php @@ -119,7 +119,7 @@ if (GETPOST("rel") == 'prev') { $found = true; } -$permissiontoadd = $user->rights->banque->modifier; // Used by the include of actions_dellink.inc.php +$permissiontoadd = $user->hasRight('banque', 'modifier'); // Used by the include of actions_dellink.inc.php /* @@ -184,8 +184,8 @@ if ($id > 0 || !empty($ref)) { $modulepart = 'bank'; - $permissiontoadd = $user->rights->banque->modifier; - $permtoedit = $user->rights->banque->modifier; + $permissiontoadd = $user->hasRight('banque', 'modifier'); + $permtoedit = $user->hasRight('banque', 'modifier'); $param = '&id='.$object->id.'&num='.urlencode($numref); $moreparam = '&num='.urlencode($numref); $relativepathwithnofile = $id."/statement/".dol_sanitizeFileName($numref)."/"; diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index c12b7801f43..fbe7f7c247a 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -235,7 +235,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' if (empty($reshook)) { $objectclass = 'Account'; $objectlabel = 'BankTransaction'; - $permissiontoread = !empty($user->rights->banque->lire); + $permissiontoread = $user->hasRight('banque', 'lire'); $permissiontodelete = $user->hasRight('banque', 'modifier'); $uploaddir = $conf->bank->dir_output; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; @@ -787,7 +787,6 @@ if ($resql) { //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"), //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), ); - //if ($user->rights->bank->supprimer) $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); if (in_array($massaction, array('presend', 'predelete'))) { $arrayofmassactions = array(); } diff --git a/htdocs/compta/bank/class/api_bankaccounts.class.php b/htdocs/compta/bank/class/api_bankaccounts.class.php index b8f9f208e5a..830273e2563 100644 --- a/htdocs/compta/bank/class/api_bankaccounts.class.php +++ b/htdocs/compta/bank/class/api_bankaccounts.class.php @@ -67,7 +67,7 @@ class BankAccounts extends DolibarrApi { $list = array(); - if (!DolibarrApiAccess::$user->rights->banque->lire) { + if (!DolibarrApiAccess::$user->hasRight('banque', 'lire')) { throw new RestException(403); } @@ -129,7 +129,7 @@ class BankAccounts extends DolibarrApi */ public function get($id) { - if (!DolibarrApiAccess::$user->rights->banque->lire) { + if (!DolibarrApiAccess::$user->hasRight('banque', 'lire')) { throw new RestException(403); } @@ -150,7 +150,7 @@ class BankAccounts extends DolibarrApi */ public function post($request_data = null) { - if (!DolibarrApiAccess::$user->rights->banque->configurer) { + if (!DolibarrApiAccess::$user->hasRight('banque', 'configurer')) { throw new RestException(403); } // Check mandatory fields @@ -201,7 +201,7 @@ class BankAccounts extends DolibarrApi */ public function transfer($bankaccount_from_id = 0, $bankaccount_to_id = 0, $date = null, $description = "", $amount = 0.0, $amount_to = 0.0) { - if (!DolibarrApiAccess::$user->rights->banque->configurer) { + if (!DolibarrApiAccess::$user->hasRight('banque', 'configurer')) { throw new RestException(403); } @@ -325,7 +325,7 @@ class BankAccounts extends DolibarrApi */ public function put($id, $request_data = null) { - if (!DolibarrApiAccess::$user->rights->banque->configurer) { + if (!DolibarrApiAccess::$user->hasRight('banque', 'configurer')) { throw new RestException(403); } @@ -363,7 +363,7 @@ class BankAccounts extends DolibarrApi */ public function delete($id) { - if (!DolibarrApiAccess::$user->rights->banque->configurer) { + if (!DolibarrApiAccess::$user->hasRight('banque', 'configurer')) { throw new RestException(403); } $account = new Account($this->db); @@ -436,7 +436,7 @@ class BankAccounts extends DolibarrApi { $list = array(); - if (!DolibarrApiAccess::$user->rights->banque->lire) { + if (!DolibarrApiAccess::$user->hasRight('banque', 'lire')) { throw new RestException(403); } @@ -499,7 +499,7 @@ class BankAccounts extends DolibarrApi */ public function addLine($id, $date, $type, $label, $amount, $category = 0, $cheque_number = '', $cheque_writer = '', $cheque_bank = '', $accountancycode = '', $datev = null, $num_releve = '') { - if (!DolibarrApiAccess::$user->rights->banque->modifier) { + if (!DolibarrApiAccess::$user->hasRight('banque', 'modifier')) { throw new RestException(403); } @@ -552,7 +552,7 @@ class BankAccounts extends DolibarrApi */ public function addLink($id, $line_id, $url_id, $url, $label, $type) { - if (!DolibarrApiAccess::$user->rights->banque->modifier) { + if (!DolibarrApiAccess::$user->hasRight('banque', 'modifier')) { throw new RestException(403); } @@ -595,7 +595,7 @@ class BankAccounts extends DolibarrApi { $list = array(); - if (!DolibarrApiAccess::$user->rights->banque->lire) { + if (!DolibarrApiAccess::$user->hasRight('banque', 'lire')) { throw new RestException(403); } diff --git a/htdocs/compta/bank/class/paymentvarious.class.php b/htdocs/compta/bank/class/paymentvarious.class.php index 5215cb53170..f74034a103b 100644 --- a/htdocs/compta/bank/class/paymentvarious.class.php +++ b/htdocs/compta/bank/class/paymentvarious.class.php @@ -60,18 +60,50 @@ class PaymentVarious extends CommonObject * @var int timestamp */ public $tms; + + /** + * @var int timestamp + */ public $datep; + + /** + * @var int timestamp + */ public $datev; /** - * @var int sens of operation + * @var int<0,1> Payment direction (debit or credit) */ public $sens; + + /** + * @var float + */ public $amount; + + /** + * @var int Payment type (fk_typepayment) + */ public $type_payment; + + /** + * @var string Payment reference + */ public $num_payment; + + /** + * @var string Name of cheque writer + */ public $chqemetteur; + + /** + * @var string Bank of cheque writer + */ public $chqbank; + + /** + * @var int Category id + */ public $category_transaction; /** @@ -499,7 +531,7 @@ class PaymentVarious extends CommonObject $result = $this->db->query($sql); if ($result) { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."payment_various"); - $this->ref = $this->id; + $this->ref = (string) $this->id; if ($this->id > 0) { if (isModEnabled("banque") && !empty($this->amount)) { diff --git a/htdocs/compta/bank/document.php b/htdocs/compta/bank/document.php index 522b2d56939..5e3eef6e06e 100644 --- a/htdocs/compta/bank/document.php +++ b/htdocs/compta/bank/document.php @@ -76,7 +76,7 @@ if ($id > 0 || !empty($ref)) { $result = restrictedArea($user, 'banque', $object->id, 'bank_account', '', ''); -$permissiontoadd = $user->rights->banque->modifier; // Used by the include of actions_dellink.inc.php +$permissiontoadd = $user->hasRight('banque', 'modifier'); // Used by the include of actions_dellink.inc.php /* @@ -139,8 +139,8 @@ if ($id > 0 || !empty($ref)) { $modulepart = 'bank'; - $permissiontoadd = $user->rights->banque->modifier; - $permtoedit = $user->rights->banque->modifier; + $permissiontoadd = $user->hasRight('banque', 'modifier'); + $permtoedit = $user->hasRight('banque', 'modifier'); $param = '&id='.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } else { diff --git a/htdocs/compta/bank/line.php b/htdocs/compta/bank/line.php index 41875945a1b..0679b01951c 100644 --- a/htdocs/compta/bank/line.php +++ b/htdocs/compta/bank/line.php @@ -375,7 +375,7 @@ if ($result) { $i++; // Bank account - print ''; + print ''; print ''; } - //$user->rights->banque->modifier=false; - //$user->rights->banque->consolidate=true; - // Type of payment / Number print "
'.$langs->trans("LastMailings", $limit).''.$langs->trans("Type").''.$langs->trans("DateCreation").''.$langs->trans("NbOfEMails").''.$langs->trans("AllEMailings").'
'; + print $langs->trans("NbOfEMails"); + if (getDolGlobalInt('EMAILINGS_SUPPORT_ALSO_SMS')) { + print ' | '.$langs->trans("Phone"); + } + print ''.$langs->trans("AllEMailings").'
'.$mailstatic->getNomUrl(1).''.(!empty($obj->title) ? dol_trunc($obj->title, 38) : '').''.dol_escape_htmltag($obj->title).''.dol_escape_htmltag($obj->messtype).''.dol_print_date($db->jdate($obj->date_creat), 'day').''.($obj->nbemail ? $obj->nbemail : "0").''.($obj->nbemail ? (int) $obj->nbemail : "0").''.$mailstatic->LibStatut($obj->status, 5).'
'; print ''; print ''; + print ''; + print ''; print ''; @@ -415,19 +439,28 @@ if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { } print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "m.rowid", $param, "", "", $sortfield, $sortorder); $totalarray['nbfield']++; +// Message type +if (getDolGlobalInt('EMAILINGS_SUPPORT_ALSO_SMS')) { + print_liste_field_titre("Type", $_SERVER["PHP_SELF"], "m.messtype", $param, "", "", $sortfield, $sortorder); + $totalarray['nbfield']++; +} print_liste_field_titre("Title", $_SERVER["PHP_SELF"], "m.titre", $param, "", "", $sortfield, $sortorder); $totalarray['nbfield']++; -print_liste_field_titre("DateCreation", $_SERVER["PHP_SELF"], "m.date_creat", $param, "", 'align="center"', $sortfield, $sortorder); +print_liste_field_titre("DateCreation", $_SERVER["PHP_SELF"], "m.date_creat", $param, "", '', $sortfield, $sortorder, 'center '); $totalarray['nbfield']++; if (!$filteremail) { - print_liste_field_titre("NbOfEMails", $_SERVER["PHP_SELF"], "m.nbemail", $param, "", 'align="center"', $sortfield, $sortorder); + $title = $langs->trans("NbOfEMails"); + if (getDolGlobalInt('EMAILINGS_SUPPORT_ALSO_SMS')) { + $title .= ' | '.$langs->trans("SMS"); + } + print_liste_field_titre($title, $_SERVER["PHP_SELF"], "m.nbemail", $param, "", '', $sortfield, $sortorder, 'center '); $totalarray['nbfield']++; } if (!$filteremail) { - print_liste_field_titre("DateLastSend", $_SERVER["PHP_SELF"], "m.date_envoi", $param, "", 'align="center"', $sortfield, $sortorder); + print_liste_field_titre("DateLastSend", $_SERVER["PHP_SELF"], "m.date_envoi", $param, "", '', $sortfield, $sortorder, 'center '); $totalarray['nbfield']++; } else { - print_liste_field_titre("DateSending", $_SERVER["PHP_SELF"], "mc.date_envoi", $param, "", 'align="center"', $sortfield, $sortorder); + print_liste_field_titre("DateSending", $_SERVER["PHP_SELF"], "mc.date_envoi", $param, "", '', $sortfield, $sortorder, 'center '); $totalarray['nbfield']++; } // Extra fields @@ -484,10 +517,18 @@ while ($i < $imaxinloop) { } } + // Ref print ''; print $object->getNomUrl(1); print ''; + print dol_escape_htmltag($obj->messtype); + print ''.dol_escape_htmltag($obj->title).''; $nbemail = $obj->nbemail; - /*if ($obj->statut != 3 && !empty($conf->global->MAILING_LIMIT_SENDBYWEB) && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail) + /*if ($obj->status != 3 && !empty($conf->global->MAILING_LIMIT_SENDBYWEB) && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail) { $text=$langs->trans('LimitSendingEmailing',$conf->global->MAILING_LIMIT_SENDBYWEB); print $form->textwithpicto($nbemail,$text,1,'warning'); @@ -514,7 +555,7 @@ while ($i < $imaxinloop) { } // Last send - print ''.dol_print_date($db->jdate($obj->date_envoi), 'day').''.dol_print_date($db->jdate($obj->date_envoi), 'day').'
'.$langs->trans("Account").'
'.$langs->trans("BankAccount").''; // $objp->fk_account may be not > 0 if data was lost by an old bug. In such a case, we let a chance to user to fix it. if (($objp->rappro || $bankline->getVentilExportCompta()) && $objp->fk_account > 0) { @@ -495,9 +495,6 @@ if ($result) { print '
".$langs->trans("Type")." / ".$langs->trans("Numero"); print ' ('.$langs->trans("ChequeOrTransferNumber").')'; @@ -654,7 +651,7 @@ if ($result) { print "
"; // Code to adjust value date with plus and less picto using an Ajax call instead of a full reload of page - /* Not yet ready. We must manage inline replacemet of input date field + /* Not yet ready. We must manage inline replacement of input date field $urlajax = DOL_URL_ROOT.'/core/ajax/bankconciliate.php?token='.currentToken(); print ' +
 
">
- id.'&mainmenu=home'; -/** - * Show list - */ + +// Show list of contact links + print '
'; print ''; print ''; diff --git a/htdocs/core/tpl/notes.tpl.php b/htdocs/core/tpl/notes.tpl.php index b4df3e4311e..8ca0cc44990 100644 --- a/htdocs/core/tpl/notes.tpl.php +++ b/htdocs/core/tpl/notes.tpl.php @@ -34,7 +34,7 @@ if ($module == "product") { } $colwidth = (isset($colwidth) ? $colwidth : (empty($cssclass) ? '25' : '')); // Set $permission from the $permissionnote var defined on calling page -$permission = (isset($permissionnote) ? $permissionnote : (isset($permission) ? $permission : (isset($user->rights->$module->create) ? $user->rights->$module->create : (isset($user->rights->$module->creer) ? $user->rights->$module->creer : 0)))); +$permission = (isset($permissionnote) ? $permissionnote : (isset($permission) ? $permission : ($user->hasRight($module, 'create') ? $user->rights->$module->create : ($user->hasRight($module, 'creer') ? $user->rights->$module->creer : 0)))); $moreparam = (isset($moreparam) ? $moreparam : ''); $value_public = $object->note_public; $value_private = $object->note_private; diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php index d614097cdc5..731d4e02f79 100644 --- a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php +++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php @@ -8,6 +8,7 @@ * Copyright (C) 2022 Ferran Marcet * Copyright (C) 2023 William Mead * Copyright (C) 2023 Christian Foellmann + * Copyright (C) 2024 William Mead * * 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 @@ -853,7 +854,7 @@ class InterfaceActionsAuto extends DolibarrTriggers if (empty($object->actionmsg2)) { if (empty($object->context['actionmsg2'])) { - $object->actionmsg2 = $langs->transnoentities("SupplierOrderSubmitedInDolibarr", ($object->newref ? $object->newref : $object->ref)); + $object->actionmsg2 = $langs->transnoentities("SupplierOrderSubmitedInDolibarr", ($object->newref ?: $object->ref), $object->getInputMethod()); } else { $object->actionmsg2 = $object->context['actionmsg2']; } diff --git a/htdocs/cron/list.php b/htdocs/cron/list.php index d93b8e445ac..e78006d9e3f 100644 --- a/htdocs/cron/list.php +++ b/htdocs/cron/list.php @@ -90,10 +90,10 @@ if (!$user->hasRight('cron', 'read')) { accessforbidden(); } -$permissiontoread = $user->rights->cron->read; +$permissiontoread = $user->hasRight('cron', 'read'); $permissiontoadd = $user->rights->cron->create ? $user->rights->cron->create : $user->rights->cron->write; -$permissiontodelete = $user->rights->cron->delete; -$permissiontoexecute = $user->rights->cron->execute; +$permissiontodelete = $user->hasRight('cron', 'delete'); +$permissiontoexecute = $user->hasRight('cron', 'execute'); /* diff --git a/htdocs/delivery/card.php b/htdocs/delivery/card.php index f87ac1bada3..eaa0525458c 100644 --- a/htdocs/delivery/card.php +++ b/htdocs/delivery/card.php @@ -92,7 +92,7 @@ $error = 0; $parameters = array(); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks // Delete Link -$permissiondellink = $user->rights->expedition->delivery->supprimer; // Used by the include of actions_dellink.inc.php +$permissiondellink = $user->hasRight('expedition', 'delivery', 'supprimer'); // Used by the include of actions_dellink.inc.php include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once if ($action == 'add') { @@ -244,7 +244,7 @@ if ($action == 'update_extras_line') { // Actions to build doc $upload_dir = $conf->expedition->dir_output.'/receipt'; -$permissiontoadd = $user->rights->expedition->creer; +$permissiontoadd = $user->hasRight('expedition', 'creer'); include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php'; @@ -671,8 +671,8 @@ if ($action == 'create') { $filedir = $conf->expedition->dir_output."/receipt/".$objectref; $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id; - $genallowed = $user->rights->expedition->delivery->lire; - $delallowed = $user->rights->expedition->delivery->creer; + $genallowed = $user->hasRight('expedition', 'delivery', 'lire'); + $delallowed = $user->hasRight('expedition', 'delivery', 'creer'); print $formfile->showdocuments('delivery', $objectref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang); diff --git a/htdocs/don/card.php b/htdocs/don/card.php index 4d352e6b65f..78f6bdb376b 100644 --- a/htdocs/don/card.php +++ b/htdocs/don/card.php @@ -86,7 +86,7 @@ $upload_dir = $conf->don->dir_output; // Security check $result = restrictedArea($user, 'don', $object->id); -$permissiontoadd = $user->rights->don->creer; +$permissiontoadd = $user->hasRight('don', 'creer'); /* @@ -962,8 +962,8 @@ if (!empty($id) && $action != 'edit') { $filename = dol_sanitizeFileName($object->id); $filedir = $conf->don->dir_output."/".dol_sanitizeFileName($object->id); $urlsource = $_SERVER['PHP_SELF'].'?rowid='.$object->id; - $genallowed = (($object->paid == 0 || $user->admin) && $user->rights->don->lire); - $delallowed = $user->rights->don->creer; + $genallowed = (($object->paid == 0 || $user->admin) && $user->hasRight('don', 'lire')); + $delallowed = $user->hasRight('don', 'creer'); print $formfile->showdocuments('donation', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf); diff --git a/htdocs/don/class/api_donations.class.php b/htdocs/don/class/api_donations.class.php index b6ca758906b..c8e3e94527f 100644 --- a/htdocs/don/class/api_donations.class.php +++ b/htdocs/don/class/api_donations.class.php @@ -62,7 +62,7 @@ class Donations extends DolibarrApi */ public function get($id) { - if (!DolibarrApiAccess::$user->rights->don->lire) { + if (!DolibarrApiAccess::$user->hasRight('don', 'lire')) { throw new RestException(403); } @@ -101,7 +101,7 @@ class Donations extends DolibarrApi */ public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '', $properties = '') { - if (!DolibarrApiAccess::$user->rights->don->lire) { + if (!DolibarrApiAccess::$user->hasRight('don', 'lire')) { throw new RestException(403); } @@ -111,13 +111,13 @@ class Donations extends DolibarrApi $socids = DolibarrApiAccess::$user->socid ? DolibarrApiAccess::$user->socid : $thirdparty_ids; $sql = "SELECT t.rowid"; - if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids)) { + if ((!DolibarrApiAccess::$user->hasRight('societe', 'client', 'voir') && !$socids)) { $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects) } $sql .= " FROM ".MAIN_DB_PREFIX."don AS t LEFT JOIN ".MAIN_DB_PREFIX."don_extrafields AS ef ON (ef.fk_object = t.rowid)"; // Modification VMR Global Solutions to include extrafields as search parameters in the API GET call, so we will be able to filter on extrafields $sql .= ' WHERE t.entity IN ('.getEntity('don').')'; - if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids)) { + if ((!DolibarrApiAccess::$user->hasRight('societe', 'client', 'voir') && !$socids)) { $sql .= " AND t.fk_soc = sc.fk_soc"; } if ($thirdparty_ids) { @@ -175,7 +175,7 @@ class Donations extends DolibarrApi */ public function post($request_data = null) { - if (!DolibarrApiAccess::$user->rights->don->creer) { + if (!DolibarrApiAccess::$user->hasRight('don', 'creer')) { throw new RestException(401, "Insuffisant rights"); } @@ -216,7 +216,7 @@ class Donations extends DolibarrApi */ public function put($id, $request_data = null) { - if (!DolibarrApiAccess::$user->rights->don->creer) { + if (!DolibarrApiAccess::$user->hasRight('don', 'creer')) { throw new RestException(403); } @@ -256,7 +256,7 @@ class Donations extends DolibarrApi */ public function delete($id) { - if (!DolibarrApiAccess::$user->rights->don->supprimer) { + if (!DolibarrApiAccess::$user->hasRight('don', 'supprimer')) { throw new RestException(403); } @@ -305,7 +305,7 @@ class Donations extends DolibarrApi */ public function validate($id, $idwarehouse = 0, $notrigger = 0) { - if (!DolibarrApiAccess::$user->rights->don->creer) { + if (!DolibarrApiAccess::$user->hasRight('don', 'creer')) { throw new RestException(403); } diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php index 7ca733c5146..a1e90e39904 100644 --- a/htdocs/don/class/don.class.php +++ b/htdocs/don/class/don.class.php @@ -839,13 +839,6 @@ class Don extends CommonObject return 0; } - /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->bom->write)) - || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->bom->bom_advance->validate)))) - { - $this->error='Permission denied'; - return -1; - }*/ - return $this->setStatusCommon($user, self::STATUS_VALIDATED, $notrigger, 'DON_REOPEN'); } diff --git a/htdocs/don/class/donstats.class.php b/htdocs/don/class/donstats.class.php index bd52f10dbc4..a4b8043f5ae 100644 --- a/htdocs/don/class/donstats.class.php +++ b/htdocs/don/class/donstats.class.php @@ -138,7 +138,6 @@ class DonationStats extends Stats { $sql = "SELECT date_format(d.datedon,'%m') as dm, sum(d.".$this->field.")"; $sql .= " FROM ".$this->from; - //if (empty($user->rights->societe->client->voir) && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= " WHERE ".dolSqlDateFilter('d.datedon', 0, 0, (int) $year, 1); $sql .= " AND ".$this->where; $sql .= " GROUP BY dm"; @@ -157,7 +156,6 @@ class DonationStats extends Stats { $sql = "SELECT date_format(d.datedon,'%m') as dm, avg(d.".$this->field.")"; $sql .= " FROM ".$this->from; - //if (empty($user->rights->societe->client->voir) && !$this->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= " WHERE ".dolSqlDateFilter('d.datedon', 0, 0, (int) $year, 1); $sql .= " AND ".$this->where; $sql .= " GROUP BY dm"; diff --git a/htdocs/don/document.php b/htdocs/don/document.php index 6931f12d744..445d38a28b7 100644 --- a/htdocs/don/document.php +++ b/htdocs/don/document.php @@ -84,7 +84,7 @@ if ($user->socid) { } $result = restrictedArea($user, 'don', $object->id); -$permissiontoadd = $user->rights->don->creer; // Used by the include of actions_dellink.inc.php +$permissiontoadd = $user->hasRight('don', 'creer'); // Used by the include of actions_dellink.inc.php /* @@ -195,8 +195,8 @@ if ($object->id) { print dol_get_fiche_end(); $modulepart = 'don'; - $permissiontoadd = $user->rights->don->creer; - $permtoedit = $user->rights->don->creer; + $permissiontoadd = $user->hasRight('don', 'creer'); + $permtoedit = $user->hasRight('don', 'creer'); $param = '&id='.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } else { diff --git a/htdocs/don/note.php b/htdocs/don/note.php index b3641446c93..e60b9b71054 100644 --- a/htdocs/don/note.php +++ b/htdocs/don/note.php @@ -57,7 +57,7 @@ if ($user->socid) { } $result = restrictedArea($user, 'don', $object->id, ''); -$permissionnote = $user->rights->don->creer; // Used by the include of actions_setnotes.inc.php +$permissionnote = $user->hasRight('don', 'creer'); // Used by the include of actions_setnotes.inc.php /* diff --git a/htdocs/don/paiement/list.php b/htdocs/don/paiement/list.php index 4f9b91530a2..267c01f9e9c 100644 --- a/htdocs/don/paiement/list.php +++ b/htdocs/don/paiement/list.php @@ -94,7 +94,7 @@ $arrayfields = array( 'c.code' => array('label'=>"Type", 'checked'=>1, 'position'=>40), 'pd.num_paiement' => array('label'=>"Numero", 'checked'=>1, 'position'=>50, 'tooltip'=>"ChequeOrTransferNumber"), 'transaction' => array('label'=>"BankTransactionLine", 'checked'=>1, 'position'=>60, 'enabled'=>(isModEnabled("banque"))), - 'ba.label' => array('label'=>"Account", 'checked'=>1, 'position'=>70, 'enabled'=>(isModEnabled("banque"))), + 'ba.label' => array('label'=>"BankAccount", 'checked'=>1, 'position'=>70, 'enabled'=>(isModEnabled("banque"))), 'pd.amount' => array('label'=>"Amount", 'checked'=>1, 'position'=>80), ); $arrayfields = dol_sort_array($arrayfields, 'position'); @@ -316,7 +316,7 @@ print ''; print ''; print ''; -print_barre_liste($langs->trans("DonationsReglement"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'bill', 0, '', '', $limit, 0, 0, 1); +print_barre_liste($langs->trans("DonationPayments"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'bill', 0, '', '', $limit, 0, 0, 1); if ($search_all) { foreach ($fieldstosearchall as $key => $val) { diff --git a/htdocs/don/stats/index.php b/htdocs/don/stats/index.php index ad544c1b921..6dc0fa264c5 100644 --- a/htdocs/don/stats/index.php +++ b/htdocs/don/stats/index.php @@ -104,85 +104,6 @@ if (!$mesg) { $px1->draw($filenamenb, $fileurlnb); } -// Build graphic amount of object -/* -$data = $stats->getAmountByMonthWithPrevYear($endyear,$startyear); -//var_dump($data); -// $data = array(array('Lib',val1,val2,val3),...) - -if (empty($user->rights->societe->client->voir) || $user->socid) -{ - $filenameamount = $dir.'/shipmentsamountinyear-'.$user->id.'-'.$year.'.png'; -} -else -{ - $filenameamount = $dir.'/shipmentsamountinyear-'.$year.'.png'; -} - -$px2 = new DolGraph(); -$mesg = $px2->isGraphKo(); -if (! $mesg) -{ - $px2->SetData($data); - $i=$startyear;$legend=array(); - while ($i <= $endyear) - { - $legend[]=$i; - $i++; - } - $px2->SetLegend($legend); - $px2->SetMaxValue($px2->GetCeilMaxValue()); - $px2->SetMinValue(min(0,$px2->GetFloorMinValue())); - $px2->SetWidth($WIDTH); - $px2->SetHeight($HEIGHT); - $px2->SetYLabel($langs->trans("AmountOfShipments")); - $px2->SetShading(3); - $px2->SetHorizTickIncrement(1); - $px2->mode='depth'; - $px2->SetTitle($langs->trans("AmountOfShipmentsByMonthHT")); - - $px2->draw($filenameamount,$fileurlamount); -} -*/ - -/* -$data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear); - -if (empty($user->rights->societe->client->voir) || $user->socid) -{ - $filename_avg = $dir.'/shipmentsaverage-'.$user->id.'-'.$year.'.png'; -} -else -{ - $filename_avg = $dir.'/shipmentsaverage-'.$year.'.png'; -} - -$px3 = new DolGraph(); -$mesg = $px3->isGraphKo(); -if (! $mesg) -{ - $px3->SetData($data); - $i=$startyear;$legend=array(); - while ($i <= $endyear) - { - $legend[]=$i; - $i++; - } - $px3->SetLegend($legend); - $px3->SetYLabel($langs->trans("AmountAverage")); - $px3->SetMaxValue($px3->GetCeilMaxValue()); - $px3->SetMinValue($px3->GetFloorMinValue()); - $px3->SetWidth($WIDTH); - $px3->SetHeight($HEIGHT); - $px3->SetShading(3); - $px3->SetHorizTickIncrement(1); - $px3->mode='depth'; - $px3->SetTitle($langs->trans("AmountAverage")); - - $px3->draw($filename_avg,$fileurl_avg); -} -*/ - // Show array $data = $stats->getAllByYear(); diff --git a/htdocs/ecm/dir_add_card.php b/htdocs/ecm/dir_add_card.php index f12f4bfb0a4..7900949b179 100644 --- a/htdocs/ecm/dir_add_card.php +++ b/htdocs/ecm/dir_add_card.php @@ -98,9 +98,9 @@ $permissiontoadd = 0; $permissiontodelete = 0; $permissiontoupload = 0; if ($module == 'ecm') { - $permissiontoadd = $user->rights->ecm->setup; - $permissiontodelete = $user->rights->ecm->setup; - $permissiontoupload = $user->rights->ecm->upload; + $permissiontoadd = $user->hasRight('ecm', 'setup'); + $permissiontodelete = $user->hasRight('ecm', 'setup'); + $permissiontoupload = $user->hasRight('ecm', 'upload'); } if ($module == 'medias') { $permissiontoadd = ($user->rights->mailing->creer || $user->rights->website->write); diff --git a/htdocs/ecm/file_card.php b/htdocs/ecm/file_card.php index c580bd97f22..78200dd9d87 100644 --- a/htdocs/ecm/file_card.php +++ b/htdocs/ecm/file_card.php @@ -103,9 +103,9 @@ if ($result < 0) { } // Permissions -$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 (!$permissiontoread) { accessforbidden(); @@ -425,8 +425,6 @@ if ($action != 'edit') { print ''.$langs->trans('Edit').''; } - //print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $user->rights->ecm->setup); - print ''; } diff --git a/htdocs/ecm/file_note.php b/htdocs/ecm/file_note.php index 4b4df1321ea..6624936141b 100644 --- a/htdocs/ecm/file_note.php +++ b/htdocs/ecm/file_note.php @@ -106,9 +106,9 @@ if ($result < 0) { exit; } -$permissionnote = $user->rights->ecm->setup; // Used by the include of actions_setnotes.inc.php +$permissionnote = $user->hasRight('ecm', 'setup'); // Used by the include of actions_setnotes.inc.php -$permissiontoread = $user->rights->ecm->read; +$permissiontoread = $user->hasRight('ecm', 'read'); if (!$permissiontoread) { accessforbidden(); diff --git a/htdocs/ecm/search.php b/htdocs/ecm/search.php index 889d205cf74..ca847e61fee 100644 --- a/htdocs/ecm/search.php +++ b/htdocs/ecm/search.php @@ -85,7 +85,7 @@ if (!empty($section)) { } } -$permissiontoread = $user->rights->ecm->read; +$permissiontoread = $user->hasRight('ecm', 'read'); if (!$permissiontoread) { accessforbidden(); diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index e36f7fced7d..a69a9d1f36b 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -2672,7 +2672,7 @@ class EmailCollector extends CommonObject if (!dol_is_dir($destdir)) { dol_mkdir($destdir); } - if (!empty($conf->global->MAIN_IMAP_USE_PHPIMAP)) { + if (getDolGlobalString('MAIN_IMAP_USE_PHPIMAP')) { foreach ($attachments as $attachment) { $attachment->save($destdir.'/'); } diff --git a/htdocs/eventorganization/conferenceorbooth_card.php b/htdocs/eventorganization/conferenceorbooth_card.php index 21d38f947b6..9364a637788 100644 --- a/htdocs/eventorganization/conferenceorbooth_card.php +++ b/htdocs/eventorganization/conferenceorbooth_card.php @@ -86,11 +86,11 @@ if (empty($action) && empty($id) && empty($ref)) { include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. // Permissions -$permissiontoread = $user->rights->eventorganization->read; -$permissiontoadd = $user->rights->eventorganization->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php +$permissiontoread = $user->hasRight('eventorganization', 'read'); +$permissiontoadd = $user->hasRight('eventorganization', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php $permissiontodelete = $user->rights->eventorganization->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT); -$permissionnote = $user->rights->eventorganization->write; // Used by the include of actions_setnotes.inc.php -$permissiondellink = $user->rights->eventorganization->write; // Used by the include of actions_dellink.inc.php +$permissionnote = $user->hasRight('eventorganization', 'write'); // Used by the include of actions_setnotes.inc.php +$permissiondellink = $user->hasRight('eventorganization', 'write'); // Used by the include of actions_dellink.inc.php $upload_dir = $conf->eventorganization->multidir_output[isset($object->entity) ? $object->entity : 1]; // Security check @@ -632,8 +632,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $relativepath = $objref.'/'.$objref.'.pdf'; $filedir = $conf->eventorganization->dir_output.'/'.$object->element.'/'.$objref; $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id; - $genallowed = $user->rights->eventorganization->read; // If you can read, you can build the PDF to read content - $delallowed = $user->rights->eventorganization->write; // If you can create/edit, you can remove a file on card + $genallowed = $user->hasRight('eventorganization', 'read'); // If you can read, you can build the PDF to read content + $delallowed = $user->hasRight('eventorganization', 'write'); // If you can create/edit, you can remove a file on card print $formfile->showdocuments('eventorganization', $object->element.'/'.$objref, $filedir, $urlsource, 0, $delallowed, $object->model_pdf, 0, 0, 0, 28, 0, '', '', '', $langs->defaultlang); } diff --git a/htdocs/eventorganization/conferenceorbooth_contact.php b/htdocs/eventorganization/conferenceorbooth_contact.php index b02996ebff8..b365fc7aec8 100644 --- a/htdocs/eventorganization/conferenceorbooth_contact.php +++ b/htdocs/eventorganization/conferenceorbooth_contact.php @@ -77,11 +77,11 @@ if ($user->socid > 0) { $isdraft = (($object->status== $object::STATUS_DRAFT) ? 1 : 0); $result = restrictedArea($user, 'eventorganization', $object->id, '', '', 'fk_soc', 'rowid', $isdraft); -$permissiontoread = $user->rights->eventorganization->read; -$permissiontoadd = $user->rights->eventorganization->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php +$permissiontoread = $user->hasRight('eventorganization', 'read'); +$permissiontoadd = $user->hasRight('eventorganization', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php $permissiontodelete = $user->rights->eventorganization->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT); -$permissionnote = $user->rights->eventorganization->write; // Used by the include of actions_setnotes.inc.php -$permissiondellink = $user->rights->eventorganization->write; // Used by the include of actions_dellink.inc.php +$permissionnote = $user->hasRight('eventorganization', 'write'); // Used by the include of actions_setnotes.inc.php +$permissiondellink = $user->hasRight('eventorganization', 'write'); // Used by the include of actions_dellink.inc.php $upload_dir = $conf->eventorganization->multidir_output[isset($object->entity) ? $object->entity : 1]; // Security check diff --git a/htdocs/eventorganization/conferenceorbooth_document.php b/htdocs/eventorganization/conferenceorbooth_document.php index b341e6a2134..2e759c02658 100644 --- a/htdocs/eventorganization/conferenceorbooth_document.php +++ b/htdocs/eventorganization/conferenceorbooth_document.php @@ -91,11 +91,11 @@ if ($id > 0 || !empty($ref)) { } // Permissions -$permissiontoread = $user->rights->eventorganization->read; -$permissiontoadd = $user->rights->eventorganization->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php +$permissiontoread = $user->hasRight('eventorganization', 'read'); +$permissiontoadd = $user->hasRight('eventorganization', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php $permissiontodelete = $user->rights->eventorganization->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT); -$permissionnote = $user->rights->eventorganization->write; // Used by the include of actions_setnotes.inc.php -$permissiondellink = $user->rights->eventorganization->write; // Used by the include of actions_dellink.inc.php +$permissionnote = $user->hasRight('eventorganization', 'write'); // Used by the include of actions_setnotes.inc.php +$permissiondellink = $user->hasRight('eventorganization', 'write'); // Used by the include of actions_dellink.inc.php $upload_dir = $conf->eventorganization->multidir_output[isset($object->entity) ? $object->entity : 1]; // Security check @@ -395,10 +395,6 @@ if ($object->id) { print dol_get_fiche_end(); $modulepart = 'eventorganization'; - //$permission = $user->rights->eventorganization->conferenceorbooth->write; - $permission = 1; - //$permtoedit = $user->rights->eventorganization->conferenceorbooth->write; - $permtoedit = 1; $param = '&id='.$object->id; //$param = ''; if ($withproject) { diff --git a/htdocs/eventorganization/conferenceorbooth_list.php b/htdocs/eventorganization/conferenceorbooth_list.php index 39f88d01a66..6c9f2b0525a 100644 --- a/htdocs/eventorganization/conferenceorbooth_list.php +++ b/htdocs/eventorganization/conferenceorbooth_list.php @@ -134,9 +134,9 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); -$permissiontoread = $user->rights->eventorganization->read; -$permissiontoadd = $user->rights->eventorganization->write; -$permissiontodelete = $user->rights->eventorganization->delete; +$permissiontoread = $user->hasRight('eventorganization', 'read'); +$permissiontoadd = $user->hasRight('eventorganization', 'write'); +$permissiontodelete = $user->hasRight('eventorganization', 'delete'); // Security check if (!isModEnabled('eventorganization')) { diff --git a/htdocs/eventorganization/conferenceorboothattendee_card.php b/htdocs/eventorganization/conferenceorboothattendee_card.php index d0cc03cde79..a80dfe8075e 100644 --- a/htdocs/eventorganization/conferenceorboothattendee_card.php +++ b/htdocs/eventorganization/conferenceorboothattendee_card.php @@ -113,11 +113,11 @@ if ($object->fk_project > 0) { } // Permissions -$permissiontoread = $user->rights->eventorganization->read; -$permissiontoadd = $user->rights->eventorganization->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php +$permissiontoread = $user->hasRight('eventorganization', 'read'); +$permissiontoadd = $user->hasRight('eventorganization', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php $permissiontodelete = $user->rights->eventorganization->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT); -$permissionnote = $user->rights->eventorganization->write; // Used by the include of actions_setnotes.inc.php -$permissiondellink = $user->rights->eventorganization->write; // Used by the include of actions_dellink.inc.php +$permissionnote = $user->hasRight('eventorganization', 'write'); // Used by the include of actions_setnotes.inc.php +$permissiondellink = $user->hasRight('eventorganization', 'write'); // Used by the include of actions_dellink.inc.php $upload_dir = $conf->eventorganization->multidir_output[isset($object->entity) ? $object->entity : 1]; @@ -637,8 +637,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $relativepath = $objref.'/'.$objref.'.pdf'; $filedir = $conf->eventorganization->dir_output.'/'.$object->element.'/'.$objref; $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id; - $genallowed = $user->rights->eventorganization->conferenceorboothattendee->read; // If you can read, you can build the PDF to read content - $delallowed = $user->rights->eventorganization->conferenceorboothattendee->write; // If you can create/edit, you can remove a file on card + $genallowed = $user->hasRight('eventorganization', 'conferenceorboothattendee', 'read'); // If you can read, you can build the PDF to read content + $delallowed = $user->hasRight('eventorganization', 'conferenceorboothattendee', 'write'); // If you can create/edit, you can remove a file on card print $formfile->showdocuments('eventorganization:ConferenceOrBoothAttendee', $object->element.'/'.$objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang); } diff --git a/htdocs/eventorganization/conferenceorboothattendee_list.php b/htdocs/eventorganization/conferenceorboothattendee_list.php index 006b870fd93..5164436088f 100644 --- a/htdocs/eventorganization/conferenceorboothattendee_list.php +++ b/htdocs/eventorganization/conferenceorboothattendee_list.php @@ -143,9 +143,9 @@ $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); // Permissions -$permissiontoread = $user->rights->eventorganization->read; -$permissiontoadd = $user->rights->eventorganization->write; -$permissiontodelete = $user->rights->eventorganization->delete; +$permissiontoread = $user->hasRight('eventorganization', 'read'); +$permissiontoadd = $user->hasRight('eventorganization', 'write'); +$permissiontodelete = $user->hasRight('eventorganization', 'delete'); // Security check if (empty($conf->eventorganization->enabled)) { diff --git a/htdocs/eventorganization/conferenceorboothattendee_note.php b/htdocs/eventorganization/conferenceorboothattendee_note.php index 8dba83ebadf..0ca03d3bcc4 100644 --- a/htdocs/eventorganization/conferenceorboothattendee_note.php +++ b/htdocs/eventorganization/conferenceorboothattendee_note.php @@ -106,8 +106,8 @@ if ($id > 0 || !empty($ref)) { } // Permissions -$permissionnote = $user->rights->eventorganization->conferenceorboothattendee->write; // Used by the include of actions_setnotes.inc.php -$permissiontoadd = $user->rights->eventorganization->conferenceorboothattendee->write; // Used by the include of actions_addupdatedelete.inc.php +$permissionnote = $user->hasRight('eventorganization', 'conferenceorboothattendee', 'write'); // Used by the include of actions_setnotes.inc.php +$permissiontoadd = $user->hasRight('eventorganization', 'conferenceorboothattendee', 'write'); // Used by the include of actions_addupdatedelete.inc.php diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 6bf40733ed9..6826801e965 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -125,8 +125,8 @@ if ($user->socid) { $result = restrictedArea($user, 'expedition', $object->id, ''); -$permissiondellink = $user->rights->expedition->delivery->creer; // Used by the include of actions_dellink.inc.php -$permissiontoadd = $user->rights->expedition->creer; +$permissiondellink = $user->hasRight('expedition', 'delivery', 'creer'); // Used by the include of actions_dellink.inc.php +$permissiontoadd = $user->hasRight('expedition', 'creer'); /* @@ -2730,8 +2730,8 @@ if ($action == 'create') { $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id; - $genallowed = $user->rights->expedition->lire; - $delallowed = $user->rights->expedition->creer; + $genallowed = $user->hasRight('expedition', 'lire'); + $delallowed = $user->hasRight('expedition', 'creer'); print $formfile->showdocuments('expedition', $objectref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang); diff --git a/htdocs/expedition/class/api_shipments.class.php b/htdocs/expedition/class/api_shipments.class.php index fe3c778153f..d46d7e57ea5 100644 --- a/htdocs/expedition/class/api_shipments.class.php +++ b/htdocs/expedition/class/api_shipments.class.php @@ -64,7 +64,7 @@ class Shipments extends DolibarrApi */ public function get($id) { - if (!DolibarrApiAccess::$user->rights->expedition->lire) { + if (!DolibarrApiAccess::$user->hasRight('expedition', 'lire')) { throw new RestException(403); } @@ -103,7 +103,7 @@ class Shipments extends DolibarrApi { global $db, $conf; - if (!DolibarrApiAccess::$user->rights->expedition->lire) { + if (!DolibarrApiAccess::$user->hasRight('expedition', 'lire')) { throw new RestException(403); } @@ -114,7 +114,7 @@ class Shipments extends DolibarrApi // If the internal user must only see his customers, force searching by him $search_sale = 0; - if (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) { + if (!DolibarrApiAccess::$user->hasRight('societe', 'client', 'voir') && !$socids) { $search_sale = DolibarrApiAccess::$user->id; } @@ -182,7 +182,7 @@ class Shipments extends DolibarrApi */ public function post($request_data = null) { - if (!DolibarrApiAccess::$user->rights->expedition->creer) { + if (!DolibarrApiAccess::$user->hasRight('expedition', 'creer')) { throw new RestException(401, "Insuffisant rights"); } // Check mandatory fields @@ -224,7 +224,7 @@ class Shipments extends DolibarrApi /* public function getLines($id) { - if(! DolibarrApiAccess::$user->rights->expedition->lire) { + if(! DolibarrApiAccess::$user->hasRight('expedition', 'lire')) { throw new RestException(403); } @@ -258,7 +258,7 @@ class Shipments extends DolibarrApi /* public function postLine($id, $request_data = null) { - if(! DolibarrApiAccess::$user->rights->expedition->creer) { + if(! DolibarrApiAccess::$user->hasRight('expedition', 'creer')) { throw new RestException(403); } @@ -326,7 +326,7 @@ class Shipments extends DolibarrApi /* public function putLine($id, $lineid, $request_data = null) { - if (! DolibarrApiAccess::$user->rights->expedition->creer) { + if (! DolibarrApiAccess::$user->hasRight('expedition', 'creer')) { throw new RestException(403); } @@ -393,7 +393,7 @@ class Shipments extends DolibarrApi */ public function deleteLine($id, $lineid) { - if (!DolibarrApiAccess::$user->rights->expedition->creer) { + if (!DolibarrApiAccess::$user->hasRight('expedition', 'creer')) { throw new RestException(403); } @@ -426,7 +426,7 @@ class Shipments extends DolibarrApi */ public function put($id, $request_data = null) { - if (!DolibarrApiAccess::$user->rights->expedition->creer) { + if (!DolibarrApiAccess::$user->hasRight('expedition', 'creer')) { throw new RestException(403); } @@ -467,7 +467,7 @@ class Shipments extends DolibarrApi */ public function delete($id) { - if (!DolibarrApiAccess::$user->rights->expedition->supprimer) { + if (!DolibarrApiAccess::$user->hasRight('expedition', 'supprimer')) { throw new RestException(403); } $result = $this->shipment->fetch($id); @@ -512,7 +512,7 @@ class Shipments extends DolibarrApi */ public function validate($id, $notrigger = 0) { - if (!DolibarrApiAccess::$user->rights->expedition->creer) { + if (!DolibarrApiAccess::$user->hasRight('expedition', 'creer')) { throw new RestException(403); } $result = $this->shipment->fetch($id); @@ -558,7 +558,7 @@ class Shipments extends DolibarrApi public function setinvoiced($id) { - if(! DolibarrApiAccess::$user->rights->expedition->creer) { + if(! DolibarrApiAccess::$user->hasRight('expedition', 'creer')) { throw new RestException(403); } if(empty($id)) { @@ -597,10 +597,10 @@ class Shipments extends DolibarrApi require_once DOL_DOCUMENT_ROOT . '/commande/class/commande.class.php'; - if(! DolibarrApiAccess::$user->rights->expedition->lire) { + if(! DolibarrApiAccess::$user->hasRight('expedition', 'lire')) { throw new RestException(403); } - if(! DolibarrApiAccess::$user->rights->expedition->creer) { + if(! DolibarrApiAccess::$user->hasRight('expedition', 'creer')) { throw new RestException(403); } if(empty($proposalid)) { @@ -634,7 +634,7 @@ class Shipments extends DolibarrApi */ public function close($id, $notrigger = 0) { - if (!DolibarrApiAccess::$user->rights->expedition->creer) { + if (!DolibarrApiAccess::$user->hasRight('expedition', 'creer')) { throw new RestException(403); } diff --git a/htdocs/expedition/dispatch.php b/htdocs/expedition/dispatch.php index cc3a31140ee..72c74a3f357 100644 --- a/htdocs/expedition/dispatch.php +++ b/htdocs/expedition/dispatch.php @@ -299,7 +299,7 @@ if ($action == 'updatelines' && $usercancreate) { } } - // If module stock is enabled and the stock decrease is done on edtion of this page + // If module stock is enabled and the stock decrease is done on edition of this page /* if (!$error && GETPOST($ent, 'int') > 0 && isModEnabled('stock') && !empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_DISPATCH_ORDER)) { $mouv = new MouvementStock($db); diff --git a/htdocs/expedition/document.php b/htdocs/expedition/document.php index f8aef745d16..fdc58396d3d 100644 --- a/htdocs/expedition/document.php +++ b/htdocs/expedition/document.php @@ -95,7 +95,7 @@ if ($user->socid) { } $result = restrictedArea($user, 'expedition', $object->id, ''); -$permissiontoadd = $user->rights->expedition->creer; // Used by the include of actions_dellink.inc.php +$permissiontoadd = $user->hasRight('expedition', 'creer'); // Used by the include of actions_dellink.inc.php /* @@ -185,8 +185,8 @@ if ($id > 0 || !empty($ref)) { print dol_get_fiche_end(); $modulepart = 'expedition'; - $permissiontoadd = $user->rights->expedition->creer; - $permtoedit = $user->rights->expedition->creer; + $permissiontoadd = $user->hasRight('expedition', 'creer'); + $permtoedit = $user->hasRight('expedition', 'creer'); $param = '&id='.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } else { diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index 2f58d6cd36a..a3e117c8662 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -207,9 +207,9 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' if (empty($reshook)) { $objectclass = 'Expedition'; $objectlabel = 'Sendings'; - $permissiontoread = $user->rights->expedition->lire; - $permissiontoadd = $user->rights->expedition->creer; - $permissiontodelete = $user->rights->expedition->supprimer; + $permissiontoread = $user->hasRight('expedition', 'lire'); + $permissiontoadd = $user->hasRight('expedition', 'creer'); + $permissiontodelete = $user->hasRight('expedition', 'supprimer'); $uploaddir = $conf->expedition->dir_output.'/sending'; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; @@ -1224,8 +1224,8 @@ $urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sorto $urlsource .= str_replace('&', '&', $param); $filedir = $diroutputmassaction; -$genallowed = $user->rights->expedition->lire; -$delallowed = $user->rights->expedition->creer; +$genallowed = $user->hasRight('expedition', 'lire'); +$delallowed = $user->hasRight('expedition', 'creer'); $title = ''; print $formfile->showdocuments('massfilesarea_sendings', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty); diff --git a/htdocs/expedition/note.php b/htdocs/expedition/note.php index 78fbcc8685b..b2e6db874ba 100644 --- a/htdocs/expedition/note.php +++ b/htdocs/expedition/note.php @@ -64,7 +64,7 @@ if ($id > 0 || !empty($ref)) { $upload_dir = $conf->expedition->dir_output."/sending/".dol_sanitizeFileName($object->ref); } -$permissionnote = $user->rights->expedition->creer; // Used by the include of actions_setnotes.inc.php +$permissionnote = $user->hasRight('expedition', 'creer'); // Used by the include of actions_setnotes.inc.php // Security check if ($user->socid) { diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 86a661d59c2..1b4a82db1b4 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -113,9 +113,9 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be includ // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('expensereportcard', 'globalcard')); -$permissionnote = $user->rights->expensereport->creer; // Used by the include of actions_setnotes.inc.php -$permissiondellink = $user->rights->expensereport->creer; // Used by the include of actions_dellink.inc.php -$permissiontoadd = $user->rights->expensereport->creer; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php +$permissionnote = $user->hasRight('expensereport', 'creer'); // Used by the include of actions_setnotes.inc.php +$permissiondellink = $user->hasRight('expensereport', 'creer'); // Used by the include of actions_dellink.inc.php +$permissiontoadd = $user->hasRight('expensereport', 'creer'); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php $upload_dir = $conf->expensereport->dir_output.'/'.dol_sanitizeFileName($object->ref); @@ -150,7 +150,7 @@ if ($user->socid) { } $result = restrictedArea($user, 'expensereport', $object->id, 'expensereport'); -$permissiontoadd = $user->rights->expensereport->creer; // Used by the include of actions_dellink.inc.php +$permissiontoadd = $user->hasRight('expensereport', 'creer'); // Used by the include of actions_dellink.inc.php /* @@ -2853,8 +2853,8 @@ if ($action != 'presend') { $filename = dol_sanitizeFileName($object->ref); $filedir = $conf->expensereport->dir_output."/".dol_sanitizeFileName($object->ref); $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id; - $genallowed = $user->rights->expensereport->creer; - $delallowed = $user->rights->expensereport->creer; + $genallowed = $user->hasRight('expensereport', 'creer'); + $delallowed = $user->hasRight('expensereport', 'creer'); $var = true; print $formfile->showdocuments('expensereport', $filename, $filedir, $urlsource, $genallowed, $delallowed); $somethingshown = $formfile->numoffiles; diff --git a/htdocs/expensereport/class/api_expensereports.class.php b/htdocs/expensereport/class/api_expensereports.class.php index 27f7601e9ef..a16d6646eb9 100644 --- a/htdocs/expensereport/class/api_expensereports.class.php +++ b/htdocs/expensereport/class/api_expensereports.class.php @@ -64,7 +64,7 @@ class ExpenseReports extends DolibarrApi */ public function get($id) { - if (!DolibarrApiAccess::$user->rights->expensereport->lire) { + if (!DolibarrApiAccess::$user->hasRight('expensereport', 'lire')) { throw new RestException(403); } @@ -99,7 +99,7 @@ class ExpenseReports extends DolibarrApi { global $db, $conf; - if (!DolibarrApiAccess::$user->rights->expensereport->lire) { + if (!DolibarrApiAccess::$user->hasRight('expensereport', 'lire')) { throw new RestException(403); } @@ -163,7 +163,7 @@ class ExpenseReports extends DolibarrApi */ public function post($request_data = null) { - if (!DolibarrApiAccess::$user->rights->expensereport->creer) { + if (!DolibarrApiAccess::$user->hasRight('expensereport', 'creer')) { throw new RestException(401, "Insuffisant rights"); } @@ -205,7 +205,7 @@ class ExpenseReports extends DolibarrApi /* public function getLines($id) { - if(! DolibarrApiAccess::$user->rights->expensereport->lire) { + if(! DolibarrApiAccess::$user->hasRight('expensereport', 'lire')) { throw new RestException(403); } @@ -239,7 +239,7 @@ class ExpenseReports extends DolibarrApi /* public function postLine($id, $request_data = null) { - if(! DolibarrApiAccess::$user->rights->expensereport->creer) { + if(! DolibarrApiAccess::$user->hasRight('expensereport', 'creer')) { throw new RestException(403); } @@ -307,7 +307,7 @@ class ExpenseReports extends DolibarrApi /* public function putLine($id, $lineid, $request_data = null) { - if(! DolibarrApiAccess::$user->rights->expensereport->creer) { + if(! DolibarrApiAccess::$user->hasRight('expensereport', 'creer')) { throw new RestException(403); } @@ -371,7 +371,7 @@ class ExpenseReports extends DolibarrApi /* public function deleteLine($id, $lineid) { - if(! DolibarrApiAccess::$user->rights->expensereport->creer) { + if(! DolibarrApiAccess::$user->hasRight('expensereport', 'creer')) { throw new RestException(403); } @@ -408,7 +408,7 @@ class ExpenseReports extends DolibarrApi */ public function put($id, $request_data = null) { - if (!DolibarrApiAccess::$user->rights->expensereport->creer) { + if (!DolibarrApiAccess::$user->hasRight('expensereport', 'creer')) { throw new RestException(403); } @@ -449,7 +449,7 @@ class ExpenseReports extends DolibarrApi */ public function delete($id) { - if (!DolibarrApiAccess::$user->rights->expensereport->supprimer) { + if (!DolibarrApiAccess::$user->hasRight('expensereport', 'supprimer')) { throw new RestException(403); } @@ -459,7 +459,7 @@ class ExpenseReports extends DolibarrApi } if (!DolibarrApi::_checkAccessToResource('expensereport', $this->expensereport->id)) { - throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } if (!$this->expensereport->delete(DolibarrApiAccess::$user)) { @@ -492,7 +492,7 @@ class ExpenseReports extends DolibarrApi /* public function validate($id, $idwarehouse=0) { - if(! DolibarrApiAccess::$user->rights->expensereport->creer) { + if(! DolibarrApiAccess::$user->hasRight('expensereport', 'creer')) { throw new RestException(403); } diff --git a/htdocs/expensereport/class/paymentexpensereport.class.php b/htdocs/expensereport/class/paymentexpensereport.class.php index 7ffe3f3987d..6ce84881a73 100644 --- a/htdocs/expensereport/class/paymentexpensereport.class.php +++ b/htdocs/expensereport/class/paymentexpensereport.class.php @@ -754,7 +754,7 @@ class PaymentExpenseReport extends CommonObject $return .= '
'.$langs->trans("Type").' : '.$this->fk_typepayment.''; } if (property_exists($this, 'fk_bank') && !is_null($this->fk_bank)) { - $return .= '
'.$langs->trans("Account").' : '.$this->fk_bank.''; + $return .= '
'.$langs->trans("BankAccount").' : '.$this->fk_bank.''; } if (property_exists($this, 'amount')) { $return .= '
'.$langs->trans("Amount").' : '.price($this->amount).''; diff --git a/htdocs/expensereport/document.php b/htdocs/expensereport/document.php index cdc82a205e3..d801b93b484 100644 --- a/htdocs/expensereport/document.php +++ b/htdocs/expensereport/document.php @@ -95,7 +95,7 @@ if ($object->id > 0) { } } -$permissiontoadd = $user->rights->expensereport->creer; // Used by the include of actions_dellink.inc.php +$permissiontoadd = $user->hasRight('expensereport', 'creer'); // Used by the include of actions_dellink.inc.php /* @@ -156,8 +156,8 @@ if ($object->id) { $modulepart = 'expensereport'; - $permissiontoadd = $user->rights->expensereport->creer; - $permtoedit = $user->rights->expensereport->creer; + $permissiontoadd = $user->hasRight('expensereport', 'creer'); + $permtoedit = $user->hasRight('expensereport', 'creer'); $param = '&id='.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } else { diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index 0d371731c90..47364111920 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -238,8 +238,8 @@ if (empty($reshook)) { // Mass actions $objectclass = 'ExpenseReport'; $objectlabel = 'ExpenseReport'; - $permissiontoread = $user->rights->expensereport->lire; - $permissiontodelete = $user->rights->expensereport->supprimer; + $permissiontoread = $user->hasRight('expensereport', 'lire'); + $permissiontodelete = $user->hasRight('expensereport', 'supprimer'); $uploaddir = $conf->expensereport->dir_output; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } @@ -497,8 +497,8 @@ if ($resql) { $childids = $user->getAllChildIds(1); - $canedit = ((in_array($user_id, $childids) && $user->rights->expensereport->creer) - || ($conf->global->MAIN_USE_ADVANCED_PERMS && $user->rights->expensereport->writeall_advance)); + $canedit = ((in_array($user_id, $childids) && $user->hasRight('expensereport', 'creer')) + || ($conf->global->MAIN_USE_ADVANCED_PERMS && $user->hasRight('expensereport', 'writeall_advance'))); // Buttons for actions if ($canedit) { @@ -1010,8 +1010,8 @@ if ($resql) { $urlsource .= str_replace('&', '&', $param); $filedir = $diroutputmassaction; - $genallowed = $user->rights->expensereport->lire; - $delallowed = $user->rights->expensereport->creer; + $genallowed = $user->hasRight('expensereport', 'lire'); + $delallowed = $user->hasRight('expensereport', 'creer'); print $formfile->showdocuments('massfilesarea_expensereport', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty); } diff --git a/htdocs/expensereport/note.php b/htdocs/expensereport/note.php index 3b10af46bc5..b13291998df 100644 --- a/htdocs/expensereport/note.php +++ b/htdocs/expensereport/note.php @@ -55,7 +55,7 @@ if (!$object->fetch($id, $ref) > 0) { dol_print_error($db); } -$permissionnote = $user->rights->expensereport->creer; // Used by the include of actions_setnotes.inc.php +$permissionnote = $user->hasRight('expensereport', 'creer'); // Used by the include of actions_setnotes.inc.php if ($object->id > 0) { // Check current user can read this expense report diff --git a/htdocs/expensereport/payment/list.php b/htdocs/expensereport/payment/list.php index 5b67b635ff4..ee6ad1dc38c 100644 --- a/htdocs/expensereport/payment/list.php +++ b/htdocs/expensereport/payment/list.php @@ -107,7 +107,7 @@ $arrayfields = array( 'u.login' =>array('label'=>"User", 'checked'=>1, 'position'=>30), 'c.libelle' =>array('label'=>"Type", 'checked'=>1, 'position'=>40), 'pndf.num_payment' =>array('label'=>"Numero", 'checked'=>1, 'position'=>50, 'tooltip'=>"ChequeOrTransferNumber"), - 'ba.label' =>array('label'=>"Account", 'checked'=>1, 'position'=>60, 'enable'=>(isModEnabled("banque"))), + 'ba.label' =>array('label'=>"BankAccount", 'checked'=>1, 'position'=>60, 'enable'=>(isModEnabled("banque"))), 'pndf.amount' =>array('label'=>"Amount", 'checked'=>1, 'position'=>70), ); $arrayfields = dol_sort_array($arrayfields, 'position'); diff --git a/htdocs/expensereport/tpl/expensereport_addfile.tpl.php b/htdocs/expensereport/tpl/expensereport_addfile.tpl.php index 6aea588a506..ff2fd3d4285 100644 --- a/htdocs/expensereport/tpl/expensereport_addfile.tpl.php +++ b/htdocs/expensereport/tpl/expensereport_addfile.tpl.php @@ -13,7 +13,7 @@ if ($action == 'editline') { print ''; $modulepart = 'expensereport'; -$permission = $user->rights->expensereport->creer; +$permission = $user->hasRight('expensereport', 'creer'); // We define var to enable the feature to add prefix of uploaded files $savingdocmask = ''; diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index 971eea5a1eb..c069e2d15b2 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -744,7 +744,7 @@ if (empty($reshook)) { // Actions to build doc $upload_dir = $conf->ficheinter->dir_output; - $permissiontoadd = $user->rights->ficheinter->creer; + $permissiontoadd = $user->hasRight('ficheinter', 'creer'); include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; if ($action == 'update_extras') { @@ -1747,8 +1747,8 @@ if ($action == 'create') { $filename = dol_sanitizeFileName($object->ref); $filedir = $conf->ficheinter->dir_output."/".$filename; $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id; - $genallowed = $user->rights->ficheinter->lire; - $delallowed = $user->rights->ficheinter->creer; + $genallowed = $user->hasRight('ficheinter', 'lire'); + $delallowed = $user->hasRight('ficheinter', 'creer'); print $formfile->showdocuments('ficheinter', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang); // Show links to link elements diff --git a/htdocs/fichinter/class/api_interventions.class.php b/htdocs/fichinter/class/api_interventions.class.php index 1b8fe55f45a..b8c5b4f187f 100644 --- a/htdocs/fichinter/class/api_interventions.class.php +++ b/htdocs/fichinter/class/api_interventions.class.php @@ -78,7 +78,7 @@ class Interventions extends DolibarrApi */ public function get($id) { - if (!DolibarrApiAccess::$user->rights->ficheinter->lire) { + if (!DolibarrApiAccess::$user->hasRight('ficheinter', 'lire')) { throw new RestException(403); } @@ -112,7 +112,7 @@ class Interventions extends DolibarrApi */ public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '', $properties = '') { - if (!DolibarrApiAccess::$user->rights->ficheinter->lire) { + if (!DolibarrApiAccess::$user->hasRight('ficheinter', 'lire')) { throw new RestException(403); } @@ -123,7 +123,7 @@ class Interventions extends DolibarrApi // If the internal user must only see his customers, force searching by him $search_sale = 0; - if (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) { + if (!DolibarrApiAccess::$user->hasRight('societe', 'client', 'voir') && !$socids) { $search_sale = DolibarrApiAccess::$user->id; } @@ -190,7 +190,7 @@ class Interventions extends DolibarrApi */ public function post($request_data = null) { - if (!DolibarrApiAccess::$user->rights->ficheinter->creer) { + if (!DolibarrApiAccess::$user->hasRight('ficheinter', 'creer')) { throw new RestException(401, "Insuffisant rights"); } // Check mandatory fields @@ -225,7 +225,7 @@ class Interventions extends DolibarrApi /* TODO public function getLines($id) { - if(! DolibarrApiAccess::$user->rights->ficheinter->lire) { + if(! DolibarrApiAccess::$user->hasRight('ficheinter', 'lire')) { throw new RestException(403); } @@ -258,7 +258,7 @@ class Interventions extends DolibarrApi */ public function postLine($id, $request_data = null) { - if (!DolibarrApiAccess::$user->rights->ficheinter->creer) { + if (!DolibarrApiAccess::$user->hasRight('ficheinter', 'creer')) { throw new RestException(401, "Insuffisant rights"); } // Check mandatory fields @@ -305,7 +305,7 @@ class Interventions extends DolibarrApi */ public function delete($id) { - if (!DolibarrApiAccess::$user->rights->ficheinter->supprimer) { + if (!DolibarrApiAccess::$user->hasRight('ficheinter', 'supprimer')) { throw new RestException(403); } $result = $this->fichinter->fetch($id); @@ -346,7 +346,7 @@ class Interventions extends DolibarrApi */ public function validate($id, $notrigger = 0) { - if (!DolibarrApiAccess::$user->rights->ficheinter->creer) { + if (!DolibarrApiAccess::$user->hasRight('ficheinter', 'creer')) { throw new RestException(401, "Insuffisant rights"); } $result = $this->fichinter->fetch($id); @@ -382,7 +382,7 @@ class Interventions extends DolibarrApi */ public function closeFichinter($id) { - if (!DolibarrApiAccess::$user->rights->ficheinter->creer) { + if (!DolibarrApiAccess::$user->hasRight('ficheinter', 'creer')) { throw new RestException(401, "Insuffisant rights"); } $result = $this->fichinter->fetch($id); diff --git a/htdocs/fichinter/document.php b/htdocs/fichinter/document.php index 98f2e077395..c6b12144a5b 100644 --- a/htdocs/fichinter/document.php +++ b/htdocs/fichinter/document.php @@ -79,7 +79,7 @@ $object->fetch($id, $ref); $upload_dir = $conf->ficheinter->dir_output.'/'.dol_sanitizeFileName($object->ref); $modulepart = 'fichinter'; -$permissiontoadd = $user->rights->ficheinter->creer; // Used by the include of actions_setnotes.inc.php +$permissiontoadd = $user->hasRight('ficheinter', 'creer'); // Used by the include of actions_setnotes.inc.php /* @@ -164,7 +164,7 @@ if ($object->id) { print dol_get_fiche_end(); $modulepart = 'ficheinter'; - $permtoedit = $user->rights->ficheinter->creer; + $permtoedit = $user->hasRight('ficheinter', 'creer'); $param = '&id='.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } else { diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index 20eb6c8e26c..12752dc3c59 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -156,9 +156,9 @@ if ($user->socid) { } $result = restrictedArea($user, 'ficheinter', $id, 'fichinter'); -$permissiontoread = $user->rights->ficheinter->lire; -$permissiontoadd = $user->rights->ficheinter->creer; -$permissiontodelete = $user->rights->ficheinter->supprimer; +$permissiontoread = $user->hasRight('ficheinter', 'lire'); +$permissiontoadd = $user->hasRight('ficheinter', 'creer'); +$permissiontodelete = $user->hasRight('ficheinter', 'supprimer'); /* diff --git a/htdocs/fichinter/note.php b/htdocs/fichinter/note.php index 471c5c64485..845294ce56a 100644 --- a/htdocs/fichinter/note.php +++ b/htdocs/fichinter/note.php @@ -49,7 +49,7 @@ $result = restrictedArea($user, 'ficheinter', $id, 'fichinter'); $object = new Fichinter($db); $object->fetch($id, $ref); -$permissionnote = $user->rights->ficheinter->creer; // Used by the include of actions_setnotes.inc.php +$permissionnote = $user->hasRight('ficheinter', 'creer'); // Used by the include of actions_setnotes.inc.php /* * Actions @@ -84,8 +84,6 @@ if ($id > 0 || !empty($ref)) { $morehtmlref = '
'; // Ref customer - //$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->ficheinter->creer, 'string', '', 0, 1); - //$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->ficheinter->creer, 'string', '', null, null, '', 1); $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); // Thirdparty diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index de2ebd90a55..5d699086ea7 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -612,7 +612,6 @@ class CommandeFournisseur extends CommonOrder */ public function fetch_lines($only_product = 0) { - global $conf; // phpcs:enable $this->lines = array(); @@ -753,7 +752,7 @@ class CommandeFournisseur extends CommonOrder */ public function valid($user, $idwarehouse = 0, $notrigger = 0) { - global $langs, $conf; + global $conf; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; $error = 0; @@ -888,7 +887,7 @@ class CommandeFournisseur extends CommonOrder public function LibStatut($status, $mode = 0, $billed = 0) { // phpcs:enable - global $conf, $langs, $hookmanager; + global $langs, $hookmanager; if (empty($this->labelStatus) || empty($this->labelStatusShort)) { $langs->load('orders'); @@ -1021,7 +1020,7 @@ class CommandeFournisseur extends CommonOrder */ public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $save_lastsearch_value = -1, $addlinktonotes = 0) { - global $langs, $conf, $user, $hookmanager; + global $langs, $user, $hookmanager; $result = ''; $params = [ @@ -1112,7 +1111,7 @@ class CommandeFournisseur extends CommonOrder */ public function getNextNumRef($soc) { - global $db, $langs, $conf; + global $langs, $conf; $langs->load("orders"); if (getDolGlobalString('COMMANDE_SUPPLIER_ADDON_NUMBER')) { @@ -3306,7 +3305,7 @@ class CommandeFournisseur extends CommonOrder */ public function getInputMethod() { - global $db, $langs; + global $langs; if ($this->methode_commande_id > 0) { $sql = "SELECT rowid, code, libelle as label"; @@ -3435,18 +3434,18 @@ class CommandeFournisseur extends CommonOrder /** * Function used to replace a product id with another one. * - * @param DoliDB $db Database handler - * @param int $origin_id Old product id - * @param int $dest_id New product id + * @param DoliDB $dbs Database handler + * @param int $origin_id Old product id + * @param int $dest_id New product id * @return bool */ - public static function replaceProduct(DoliDB $db, $origin_id, $dest_id) + public static function replaceProduct(DoliDB $dbs, $origin_id, $dest_id) { $tables = array( 'commande_fournisseurdet' ); - return CommonObject::commonReplaceProduct($db, $origin_id, $dest_id, $tables); + return CommonObject::commonReplaceProduct($dbs, $origin_id, $dest_id, $tables); } /** @@ -3489,6 +3488,8 @@ class CommandeFournisseur extends CommonOrder { global $conf, $langs; + $langs->load('orders'); + $text = ''; if ($this->statut == self::STATUS_ORDERSENT || $this->statut == self::STATUS_RECEIVED_PARTIALLY) { @@ -3518,8 +3519,6 @@ class CommandeFournisseur extends CommonOrder */ public function calcAndSetStatusDispatch(User $user, $closeopenorder = 1, $comment = '') { - global $conf, $langs; - if (isModEnabled("supplier_order")) { require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.dispatch.class.php'; @@ -3817,8 +3816,6 @@ class CommandeFournisseurLigne extends CommonOrderLine */ public function fetch($rowid) { - global $conf; - $sql = 'SELECT cd.rowid, cd.fk_commande, cd.fk_product, cd.product_type, cd.description, cd.qty, cd.tva_tx, cd.special_code,'; $sql .= ' cd.localtax1_tx, cd.localtax2_tx, cd.localtax1_type, cd.localtax2_type, cd.ref as ref_supplier,'; $sql .= ' cd.remise, cd.remise_percent, cd.subprice,'; diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index d2b63da001d..273295c149a 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -230,7 +230,7 @@ class FactureFournisseur extends CommonInvoice public $transport_mode_id; /** - * @var int VAT reverse charge can be used on the invoice + * @var int<0,1> VAT reverse charge can be used on the invoice */ public $vat_reverse_charge; diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index dfbca7311d5..035c088db87 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -412,7 +412,7 @@ class ProductFournisseur extends Product $qty = price2num($qty, 'MS'); $unitBuyPrice = price2num($buyprice / $qty, 'MU'); - // We can have a puchase ref that need to buy 100 min for a given price and with a packaging of 50. + // We can have a purchase ref that need to buy 100 min for a given price and with a packaging of 50. //$packaging = price2num(((empty($this->packaging) || $this->packaging < $qty) ? $qty : $this->packaging), 'MS'); $packaging = price2num((empty($this->packaging) ? $qty : $this->packaging), 'MS'); diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index 1c56799d7f3..56b24d73985 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -53,12 +53,12 @@ $cancel = GETPOST('cancel', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha'); $backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); -$facid = GETPOST('facid', 'int'); -$socid = GETPOST('socid', 'int'); -$accountid = GETPOST('accountid', 'int'); -$day = GETPOST('day', 'int'); -$month = GETPOST('month', 'int'); -$year = GETPOST('year', 'int'); +$facid = GETPOSTINT('facid'); +$socid = GETPOSTINT('socid'); +$accountid = GETPOSTINT('accountid'); +$day = GETPOSTINT('day'); +$month = GETPOSTINT('month'); +$year = GETPOSTINT('year'); $search_ref = GETPOST('search_ref', 'alpha'); $search_account = GETPOST('search_account', 'int'); @@ -67,10 +67,10 @@ $search_amount = GETPOST('search_amount', 'alpha'); // alpha because we must be $search_company = GETPOST('search_company', 'alpha'); $search_payment_num = GETPOST('search_payment_num', 'alpha'); -$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; +$limit = GETPOSTINT('limit') ? GETPOST('limit') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); -$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); +$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page"); if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 @@ -315,10 +315,10 @@ if (empty($reshook)) { $paiement->multicurrency_amounts = $multicurrency_amounts; $paiement->multicurrency_code = $multicurrency_code; // Array with all currency of payments dispatching $paiement->multicurrency_tx = $multicurrency_tx; // Array with all currency tx of payments dispatching - $paiement->paiementid = GETPOST('paiementid', 'int'); + $paiement->paiementid = GETPOSTINT('paiementid'); $paiement->num_payment = GETPOST('num_paiement', 'alphanohtml'); $paiement->note_private = GETPOST('comment', 'alpha'); - $paiement->fk_account = GETPOST('accountid', 'int'); + $paiement->fk_account = GETPOSTINT('accountid'); if (!$error) { // Create payment and update this->multicurrency_amounts if this->amounts filled or diff --git a/htdocs/fourn/paiement/list.php b/htdocs/fourn/paiement/list.php index cd42464d2f3..2112f64f385 100644 --- a/htdocs/fourn/paiement/list.php +++ b/htdocs/fourn/paiement/list.php @@ -102,7 +102,7 @@ $arrayfields = array( 's.nom' =>array('label'=>"ThirdParty", 'checked'=>1, 'position'=>30), 'c.libelle' =>array('label'=>"Type", 'checked'=>1, 'position'=>40), 'p.num_paiement' =>array('label'=>"Numero", 'checked'=>1, 'position'=>50, 'tooltip'=>"ChequeOrTransferNumber"), - 'ba.label' =>array('label'=>"Account", 'checked'=>1, 'position'=>60, 'enable'=>(isModEnabled("banque"))), + 'ba.label' =>array('label'=>"BankAccount", 'checked'=>1, 'position'=>60, 'enable'=>(isModEnabled("banque"))), 'p.amount' =>array('label'=>"Amount", 'checked'=>1, 'position'=>70), ); $arrayfields = dol_sort_array($arrayfields, 'position'); diff --git a/htdocs/ftp/index.php b/htdocs/ftp/index.php index a015d68976d..b3b8a166cc5 100644 --- a/htdocs/ftp/index.php +++ b/htdocs/ftp/index.php @@ -611,13 +611,6 @@ if (!function_exists('ftp_connect')) { // Actions - /* - if ($user->rights->ftp->write && !empty($section)) - { - $formfile->form_attach_new_file(DOL_URL_ROOT.'/ftp/index.php','',0,$section,1); - } - else print ' '; - */ print '
'; print '
'; diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index 5b9c527a019..83828e91488 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -1623,8 +1623,8 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') { $relativepath = $objref.'/'.$objref.'.pdf'; $filedir = $conf->holiday->dir_output.'/'.$object->element.'/'.$objref; $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id; - $genallowed = ($user->rights->holiday->read && $object->fk_user == $user->id) || !empty($user->rights->holiday->readall); // If you can read, you can build the PDF to read content - $delallowed = ($user->rights->holiday->write && $object->fk_user == $user->id) || !empty($user->rights->holiday->writeall_advance); // If you can create/edit, you can remove a file on card + $genallowed = ($user->hasRight('holiday', 'read') && $object->fk_user == $user->id) || $user->hasRight('holiday', 'readall'); // If you can read, you can build the PDF to read content + $delallowed = ($user->hasRight('holiday', 'write') && $object->fk_user == $user->id) || $user->hasRight('holiday', 'writeall_advance'); // If you can create/edit, you can remove a file on card print $formfile->showdocuments('holiday:Holiday', $object->element.'/'.$objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang); } diff --git a/htdocs/holiday/document.php b/htdocs/holiday/document.php index 69615a2b9af..c72a42e5631 100644 --- a/htdocs/holiday/document.php +++ b/htdocs/holiday/document.php @@ -104,7 +104,7 @@ if ($user->socid) { } $result = restrictedArea($user, 'holiday', $object->id, 'holiday'); -$permissiontoadd = $user->rights->holiday->write; // Used by the include of actions_setnotes.inc.php +$permissiontoadd = $user->hasRight('holiday', 'write'); // Used by the include of actions_setnotes.inc.php /* @@ -286,8 +286,8 @@ if ($object->id) { print dol_get_fiche_end(); - $permissiontoadd = $user->rights->holiday->write; - $permtoedit = $user->rights->holiday->write; + $permissiontoadd = $user->hasRight('holiday', 'write'); + $permtoedit = $user->hasRight('holiday', 'write'); $param = '&id='.$object->id; $relativepathwithnofile = dol_sanitizeFileName($object->ref).'/'; $savingdocmask = dol_sanitizeFileName($object->ref).'-__file__'; diff --git a/htdocs/hrm/evaluation_agenda.php b/htdocs/hrm/evaluation_agenda.php index 44437c1a6fa..6a51a67396a 100644 --- a/htdocs/hrm/evaluation_agenda.php +++ b/htdocs/hrm/evaluation_agenda.php @@ -90,8 +90,8 @@ if ($id > 0 || !empty($ref)) { } // Permissions -$permissiontoadd = $user->rights->hrm->evaluation->write; // Used by the include of actions_addupdatedelete.inc.php -$permissiontoread = $user->rights->hrm->evaluation->read; // Used by the include of actions_addupdatedelete.inc.php +$permissiontoadd = $user->hasRight('hrm', 'evaluation', 'write'); // Used by the include of actions_addupdatedelete.inc.php +$permissiontoread = $user->hasRight('hrm', 'evaluation', 'read'); // Used by the include of actions_addupdatedelete.inc.php // Security check (enable the most restrictive one) //if ($user->socid > 0) accessforbidden(); diff --git a/htdocs/hrm/evaluation_card.php b/htdocs/hrm/evaluation_card.php index e7681e75b6c..742b109fc1f 100644 --- a/htdocs/hrm/evaluation_card.php +++ b/htdocs/hrm/evaluation_card.php @@ -81,12 +81,12 @@ if (empty($action) && empty($id) && empty($ref)) { include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. // Permissions -$permissiontoread = $user->rights->hrm->evaluation->read; -$permissiontoadd = $user->rights->hrm->evaluation->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php -$permissiontovalidate = (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->rights->hrm->evaluation_advance->validate) || (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $permissiontoadd); -$permissiontoClose = $user->rights->hrm->evaluation->write; -$permissiontodelete = $user->rights->hrm->evaluation->delete/* || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT)*/; -$permissiondellink = $user->rights->hrm->evaluation->write; // Used by the include of actions_dellink.inc.php +$permissiontoread = $user->hasRight('hrm', 'evaluation', 'read'); +$permissiontoadd = $user->hasRight('hrm', 'evaluation', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php +$permissiontovalidate = (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('hrm', 'evaluation_advance', 'validate')) || (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $permissiontoadd); +$permissiontoClose = $user->hasRight('hrm', 'evaluation', 'write'); +$permissiontodelete = $user->hasRight('hrm', 'evaluation', 'delete')/* || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT)*/; +$permissiondellink = $user->hasRight('hrm', 'evaluation', 'write'); // Used by the include of actions_dellink.inc.php $upload_dir = $conf->hrm->multidir_output[isset($object->entity) ? $object->entity : 1].'/evaluation'; // Security check (enable the most restrictive one) @@ -691,8 +691,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $relativepath = $objref.'/'.$objref.'.pdf'; $filedir = $conf->hrm->dir_output.'/'.$object->element.'/'.$objref; $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id; - $genallowed = $user->rights->hrm->evaluation->read; // If you can read, you can build the PDF to read content - $delallowed = $user->rights->hrm->evaluation->write; // If you can create/edit, you can remove a file on card + $genallowed = $user->hasRight('hrm', 'evaluation', 'read'); // If you can read, you can build the PDF to read content + $delallowed = $user->hasRight('hrm', 'evaluation', 'write'); // If you can create/edit, you can remove a file on card print $formfile->showdocuments('hrm:Evaluation', $object->element.'/'.$objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang, '', $object, 0, 'remove_file_comfirm'); } diff --git a/htdocs/hrm/evaluation_contact.php b/htdocs/hrm/evaluation_contact.php index 60fa5223d07..d99f76d4588 100644 --- a/htdocs/hrm/evaluation_contact.php +++ b/htdocs/hrm/evaluation_contact.php @@ -57,7 +57,7 @@ $extrafields->fetch_name_optionals_label($object->table_element); include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals // Permissions -$permission = $user->rights->hrm->evaluation->write; +$permission = $user->hasRight('hrm', 'evaluation', 'write'); // Security check (enable the most restrictive one) //if ($user->socid > 0) accessforbidden(); diff --git a/htdocs/hrm/evaluation_document.php b/htdocs/hrm/evaluation_document.php index 51262f6edf2..4ec3fc93b2e 100644 --- a/htdocs/hrm/evaluation_document.php +++ b/htdocs/hrm/evaluation_document.php @@ -81,8 +81,8 @@ if ($id > 0 || !empty($ref)) { } // Permissions -$permissiontoadd = $user->rights->hrm->evaluation->write; // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles.inc.php -$permissiontoread = $user->rights->hrm->evaluation->read; +$permissiontoadd = $user->hasRight('hrm', 'evaluation', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles.inc.php +$permissiontoread = $user->hasRight('hrm', 'evaluation', 'read'); // Security check (enable the most restrictive one) //if ($user->socid > 0) accessforbidden(); diff --git a/htdocs/hrm/evaluation_note.php b/htdocs/hrm/evaluation_note.php index ba0ec02d616..37a8a479af7 100644 --- a/htdocs/hrm/evaluation_note.php +++ b/htdocs/hrm/evaluation_note.php @@ -60,8 +60,8 @@ if ($id > 0 || !empty($ref)) { } // Permissions -$permissionnote = $user->rights->hrm->evaluation->write; // Used by the include of actions_setnotes.inc.php -$permissiontoread = $user->rights->hrm->evaluation->read; // Used by the include of actions_addupdatedelete.inc.php +$permissionnote = $user->hasRight('hrm', 'evaluation', 'write'); // Used by the include of actions_setnotes.inc.php +$permissiontoread = $user->hasRight('hrm', 'evaluation', 'read'); // Used by the include of actions_addupdatedelete.inc.php // Security check (enable the most restrictive one) //if ($user->socid > 0) accessforbidden(); diff --git a/htdocs/hrm/job_agenda.php b/htdocs/hrm/job_agenda.php index 671d10c8a74..f13d0e88d8b 100644 --- a/htdocs/hrm/job_agenda.php +++ b/htdocs/hrm/job_agenda.php @@ -88,8 +88,8 @@ if ($id > 0 || !empty($ref)) { } // Permissions -$permissiontoread = $user->rights->hrm->all->read; -$permissiontoadd = $user->rights->hrm->all->write; // Used by the include of actions_addupdatedelete.inc.php +$permissiontoread = $user->hasRight('hrm', 'all', 'read'); +$permissiontoadd = $user->hasRight('hrm', 'all', 'write'); // Used by the include of actions_addupdatedelete.inc.php // Security check (enable the most restrictive one) //if ($user->socid > 0) accessforbidden(); diff --git a/htdocs/hrm/job_card.php b/htdocs/hrm/job_card.php index 3ca13ca1b77..1cfbc38a80e 100644 --- a/htdocs/hrm/job_card.php +++ b/htdocs/hrm/job_card.php @@ -78,9 +78,9 @@ if (empty($action) && empty($id) && empty($ref)) { include DOL_DOCUMENT_ROOT . '/core/actions_fetchobject.inc.php'; // Must be include, not include_once. // Permissions -$permissiontoread = $user->rights->hrm->all->read; -$permissiontoadd = $user->rights->hrm->all->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php -$permissiontodelete = $user->rights->hrm->all->delete; +$permissiontoread = $user->hasRight('hrm', 'all', 'read'); +$permissiontoadd = $user->hasRight('hrm', 'all', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php +$permissiontodelete = $user->hasRight('hrm', 'all', 'delete'); $upload_dir = $conf->hrm->multidir_output[isset($object->entity) ? $object->entity : 1] . '/job'; // Security check (enable the most restrictive one) @@ -504,8 +504,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $relativepath = $objref . '/' . $objref . '.pdf'; $filedir = $conf->hrm->dir_output . '/' . $object->element . '/' . $objref; $urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id; - $genallowed = $user->rights->hrm->job->read; // If you can read, you can build the PDF to read content - $delallowed = $user->rights->hrm->job->write; // If you can create/edit, you can remove a file on card + $genallowed = $user->hasRight('hrm', 'job', 'read'); // If you can read, you can build the PDF to read content + $delallowed = $user->hasRight('hrm', 'job', 'write'); // If you can create/edit, you can remove a file on card print $formfile->showdocuments('hrm:Job', $object->element . '/' . $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang); } diff --git a/htdocs/hrm/job_document.php b/htdocs/hrm/job_document.php index b6b1e19412a..3f9ff9a74dc 100644 --- a/htdocs/hrm/job_document.php +++ b/htdocs/hrm/job_document.php @@ -80,8 +80,8 @@ if ($id > 0 || !empty($ref)) { } // Permissions -$permissiontoread = $user->rights->hrm->all->read; -$permissiontoadd = $user->rights->hrm->all->write; // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles.inc.php +$permissiontoread = $user->hasRight('hrm', 'all', 'read'); +$permissiontoadd = $user->hasRight('hrm', 'all', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles.inc.php // Security check (enable the most restrictive one) //if ($user->socid > 0) accessforbidden(); @@ -158,9 +158,6 @@ if ($object->id) { print dol_get_fiche_end(); $modulepart = 'hrm'; - //$permissiontoadd = $user->rights->hrm->job->write; - //$permtoedit = $user->rights->hrm->job->write; - $permtoedit = $permissiontoadd; $param = '&id='.$object->id; //$relativepathwithnofile='job/' . dol_sanitizeFileName($object->id).'/'; diff --git a/htdocs/hrm/job_list.php b/htdocs/hrm/job_list.php index aa66d55dd4a..182c6030f76 100644 --- a/htdocs/hrm/job_list.php +++ b/htdocs/hrm/job_list.php @@ -133,9 +133,9 @@ $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); // Permissions -$permissiontoread = $user->rights->hrm->all->read; -$permissiontoadd = $user->rights->hrm->all->write; -$permissiontodelete = $user->rights->hrm->all->delete; +$permissiontoread = $user->hasRight('hrm', 'all', 'read'); +$permissiontoadd = $user->hasRight('hrm', 'all', 'write'); +$permissiontodelete = $user->hasRight('hrm', 'all', 'delete'); // Security check (enable the most restrictive one) if ($user->socid > 0) { diff --git a/htdocs/hrm/job_note.php b/htdocs/hrm/job_note.php index 2d2b340fee5..61d82ec2781 100644 --- a/htdocs/hrm/job_note.php +++ b/htdocs/hrm/job_note.php @@ -59,8 +59,8 @@ if ($id > 0 || !empty($ref)) { } // Permissions -$permissiontoread = $user->rights->hrm->all->read; -$permissionnote = $user->rights->hrm->all->write; // Used by the include of actions_addupdatedelete.inc.php +$permissiontoread = $user->hasRight('hrm', 'all', 'read'); +$permissionnote = $user->hasRight('hrm', 'all', 'write'); // Used by the include of actions_addupdatedelete.inc.php // Security check (enable the most restrictive one) //if ($user->socid > 0) accessforbidden(); diff --git a/htdocs/hrm/position.php b/htdocs/hrm/position.php index 7ef6bf1c24c..7b3617c5778 100644 --- a/htdocs/hrm/position.php +++ b/htdocs/hrm/position.php @@ -146,9 +146,9 @@ $arrayfields = dol_sort_array($arrayfields, 'position'); include DOL_DOCUMENT_ROOT . '/core/actions_fetchobject.inc.php'; // Must be include, not include_once. // Permissions -$permissiontoread = $user->rights->hrm->all->read; -$permissiontoadd = $user->rights->hrm->all->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php -$permissiontodelete = $user->rights->hrm->all->delete; +$permissiontoread = $user->hasRight('hrm', 'all', 'read'); +$permissiontoadd = $user->hasRight('hrm', 'all', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php +$permissiontodelete = $user->hasRight('hrm', 'all', 'delete'); $upload_dir = $conf->hrm->multidir_output[isset($object->entity) ? $object->entity : 1] . '/position'; // Security check (enable the most restrictive one) diff --git a/htdocs/hrm/position_agenda.php b/htdocs/hrm/position_agenda.php index b1534dc9787..232acae98c3 100644 --- a/htdocs/hrm/position_agenda.php +++ b/htdocs/hrm/position_agenda.php @@ -91,8 +91,8 @@ if ($id > 0 || !empty($ref)) { } // Permissions -$permissiontoread = $user->rights->hrm->all->read; -$permissiontoadd = $user->rights->hrm->all->write; // Used by the include of actions_addupdatedelete.inc.php +$permissiontoread = $user->hasRight('hrm', 'all', 'read'); +$permissiontoadd = $user->hasRight('hrm', 'all', 'write'); // Used by the include of actions_addupdatedelete.inc.php // Security check (enable the most restrictive one) //if ($user->socid > 0) accessforbidden(); diff --git a/htdocs/hrm/position_card.php b/htdocs/hrm/position_card.php index 0dda7f0bea1..dc83d41e0d5 100644 --- a/htdocs/hrm/position_card.php +++ b/htdocs/hrm/position_card.php @@ -52,10 +52,10 @@ if ($res < 0) { } // Permissions -$permissiontoread = $user->rights->hrm->all->read; -$permissiontoadd = $user->rights->hrm->all->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php -$permissiontodelete = $user->rights->hrm->all->delete; -$permissiondellink = $user->rights->hrm->all->write; // Used by the include of actions_dellink.inc.php +$permissiontoread = $user->hasRight('hrm', 'all', 'read'); +$permissiontoadd = $user->hasRight('hrm', 'all', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php +$permissiontodelete = $user->hasRight('hrm', 'all', 'delete'); +$permissiondellink = $user->hasRight('hrm', 'all', 'write'); // Used by the include of actions_dellink.inc.php $upload_dir = $conf->hrm->multidir_output[isset($object->entity) ? $object->entity : 1] . '/position'; // Security check (enable the most restrictive one) diff --git a/htdocs/hrm/position_document.php b/htdocs/hrm/position_document.php index 5de8d3f0e33..d32e56ee93b 100644 --- a/htdocs/hrm/position_document.php +++ b/htdocs/hrm/position_document.php @@ -80,8 +80,8 @@ if ($id > 0 || !empty($ref)) { } // Permissions -$permissiontoread = $user->rights->hrm->all->read; -$permissiontoadd = $user->rights->hrm->all->write; // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles.inc.php +$permissiontoread = $user->hasRight('hrm', 'all', 'read'); +$permissiontoadd = $user->hasRight('hrm', 'all', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles.inc.php // Security check (enable the most restrictive one) //if ($user->socid > 0) accessforbidden(); diff --git a/htdocs/hrm/position_list.php b/htdocs/hrm/position_list.php index bb9c888f93a..fd45a8c6f2b 100644 --- a/htdocs/hrm/position_list.php +++ b/htdocs/hrm/position_list.php @@ -134,9 +134,9 @@ $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); // Permissions -$permissiontoread = $user->rights->hrm->all->read; -$permissiontoadd = $user->rights->hrm->all->write; -$permissiontodelete = $user->rights->hrm->all->delete; +$permissiontoread = $user->hasRight('hrm', 'all', 'read'); +$permissiontoadd = $user->hasRight('hrm', 'all', 'write'); +$permissiontodelete = $user->hasRight('hrm', 'all', 'delete'); // Security check (enable the most restrictive one) if ($user->socid > 0) { diff --git a/htdocs/hrm/position_note.php b/htdocs/hrm/position_note.php index 7a23d7d7b7d..d7a9efa6cba 100644 --- a/htdocs/hrm/position_note.php +++ b/htdocs/hrm/position_note.php @@ -57,8 +57,8 @@ if ($id > 0 || !empty($ref)) { } // Permissions -$permissionnote = $user->rights->hrm->all->write; -$permissiontoread = $user->rights->hrm->all->read; // Used by the include of actions_addupdatedelete.inc.php +$permissionnote = $user->hasRight('hrm', 'all', 'write'); +$permissiontoread = $user->hasRight('hrm', 'all', 'read'); // Used by the include of actions_addupdatedelete.inc.php // Security check (enable the most restrictive one) //if ($user->socid > 0) accessforbidden(); diff --git a/htdocs/hrm/skill_agenda.php b/htdocs/hrm/skill_agenda.php index a2899731f8d..e6b5368a782 100644 --- a/htdocs/hrm/skill_agenda.php +++ b/htdocs/hrm/skill_agenda.php @@ -90,8 +90,8 @@ if ($id > 0 || !empty($ref)) { } // Permissions -$permissiontoread = $user->rights->hrm->all->read; -$permissiontoadd = $user->rights->hrm->all->write; // Used by the include of actions_addupdatedelete.inc.php +$permissiontoread = $user->hasRight('hrm', 'all', 'read'); +$permissiontoadd = $user->hasRight('hrm', 'all', 'write'); // Used by the include of actions_addupdatedelete.inc.php // Security check (enable the most restrictive one) //if ($user->socid > 0) accessforbidden(); diff --git a/htdocs/hrm/skill_card.php b/htdocs/hrm/skill_card.php index 434b6b49979..bd2070a4f71 100644 --- a/htdocs/hrm/skill_card.php +++ b/htdocs/hrm/skill_card.php @@ -79,9 +79,9 @@ if (empty($action) && empty($id) && empty($ref)) { include DOL_DOCUMENT_ROOT . '/core/actions_fetchobject.inc.php'; // Must be include, not include_once. // Permissions -$permissiontoread = $user->rights->hrm->all->read; -$permissiontoadd = $user->rights->hrm->all->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php -$permissiontodelete = $user->rights->hrm->all->delete; +$permissiontoread = $user->hasRight('hrm', 'all', 'read'); +$permissiontoadd = $user->hasRight('hrm', 'all', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php +$permissiontodelete = $user->hasRight('hrm', 'all', 'delete'); $upload_dir = $conf->hrm->multidir_output[isset($object->entity) ? $object->entity : 1] . '/skill'; // Security check (enable the most restrictive one) diff --git a/htdocs/hrm/skill_document.php b/htdocs/hrm/skill_document.php index 4cd88ca4578..6c898faced2 100644 --- a/htdocs/hrm/skill_document.php +++ b/htdocs/hrm/skill_document.php @@ -80,8 +80,8 @@ if ($id > 0 || !empty($ref)) { } // Permissions -$permissiontoread = $user->rights->hrm->all->read; -$permissiontoadd = $user->rights->hrm->all->write; // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles.inc.php +$permissiontoread = $user->hasRight('hrm', 'all', 'read'); +$permissiontoadd = $user->hasRight('hrm', 'all', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles.inc.php // Security check (enable the most restrictive one) //if ($user->socid > 0) accessforbidden(); diff --git a/htdocs/hrm/skill_note.php b/htdocs/hrm/skill_note.php index 85822772375..645180ec4ec 100644 --- a/htdocs/hrm/skill_note.php +++ b/htdocs/hrm/skill_note.php @@ -57,8 +57,8 @@ if ($id > 0 || !empty($ref)) { } // Permissions -$permissionnote = $user->rights->hrm->all->write; -$permissiontoread = $user->rights->hrm->all->read; // Used by the include of actions_addupdatedelete.inc.php +$permissionnote = $user->hasRight('hrm', 'all', 'write'); +$permissiontoread = $user->hasRight('hrm', 'all', 'read'); // Used by the include of actions_addupdatedelete.inc.php // Security check (enable the most restrictive one) //if ($user->socid > 0) accessforbidden(); diff --git a/htdocs/imports/class/import.class.php b/htdocs/imports/class/import.class.php index 0687650ce8a..05d8b4bb54b 100644 --- a/htdocs/imports/class/import.class.php +++ b/htdocs/imports/class/import.class.php @@ -171,7 +171,7 @@ class Import } // Permission - $this->array_import_perms[$i] = $user->rights->import->run; + $this->array_import_perms[$i] = $user->hasRight('import', 'run'); // Icon $this->array_import_icon[$i] = (isset($module->import_icon[$r]) ? $module->import_icon[$r] : $module->picto); // Code of dataset export diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php index 4eb466dbf76..1f20107db80 100644 --- a/htdocs/imports/import.php +++ b/htdocs/imports/import.php @@ -34,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/import.lib.php'; // Load translation files required by the page -$langs->loadLangs(array('exports', 'compta', 'errors')); +$langs->loadLangs(array('exports', 'compta', 'errors', 'admin')); // Security check $result = restrictedArea($user, 'import'); diff --git a/htdocs/install/doctemplates/websites/website_template-corporate/containers/blog-our-company-is-now-on-dolibarr.php b/htdocs/install/doctemplates/websites/website_template-corporate/containers/blog-our-company-is-now-on-dolibarr.php deleted file mode 100644 index 99c4f10314b..00000000000 --- a/htdocs/install/doctemplates/websites/website_template-corporate/containers/blog-our-company-is-now-on-dolibarr.php +++ /dev/null @@ -1,5 +0,0 @@ -ref.'/page180.tpl.php'; -?> diff --git a/htdocs/install/doctemplates/websites/website_template-corporate/containers/blog-our-new-web-site-has-been-launched.php b/htdocs/install/doctemplates/websites/website_template-corporate/containers/blog-our-new-web-site-has-been-launched.php deleted file mode 100644 index 248bb708f48..00000000000 --- a/htdocs/install/doctemplates/websites/website_template-corporate/containers/blog-our-new-web-site-has-been-launched.php +++ /dev/null @@ -1,5 +0,0 @@ -ref.'/page181.tpl.php'; -?> diff --git a/htdocs/install/doctemplates/websites/website_template-corporate/containers/blog.php b/htdocs/install/doctemplates/websites/website_template-corporate/containers/blog.php deleted file mode 100644 index 43a0212d3f6..00000000000 --- a/htdocs/install/doctemplates/websites/website_template-corporate/containers/blog.php +++ /dev/null @@ -1,5 +0,0 @@ -ref.'/page179.tpl.php'; -?> diff --git a/htdocs/install/doctemplates/websites/website_template-corporate/containers/careers.php b/htdocs/install/doctemplates/websites/website_template-corporate/containers/careers.php deleted file mode 100644 index a2c8a7165a7..00000000000 --- a/htdocs/install/doctemplates/websites/website_template-corporate/containers/careers.php +++ /dev/null @@ -1,5 +0,0 @@ -ref.'/page182.tpl.php'; -?> diff --git a/htdocs/install/doctemplates/websites/website_template-corporate/containers/carriere.php b/htdocs/install/doctemplates/websites/website_template-corporate/containers/carriere.php deleted file mode 100644 index f32f4818ac4..00000000000 --- a/htdocs/install/doctemplates/websites/website_template-corporate/containers/carriere.php +++ /dev/null @@ -1,5 +0,0 @@ -ref.'/page183.tpl.php'; -?> diff --git a/htdocs/install/doctemplates/websites/website_template-corporate/containers/clients-testimonials.php b/htdocs/install/doctemplates/websites/website_template-corporate/containers/clients-testimonials.php deleted file mode 100644 index 2c01e32e135..00000000000 --- a/htdocs/install/doctemplates/websites/website_template-corporate/containers/clients-testimonials.php +++ /dev/null @@ -1,5 +0,0 @@ -ref.'/page184.tpl.php'; -?> diff --git a/htdocs/install/doctemplates/websites/website_template-corporate/containers/contact.php b/htdocs/install/doctemplates/websites/website_template-corporate/containers/contact.php deleted file mode 100644 index 2c9c69905fa..00000000000 --- a/htdocs/install/doctemplates/websites/website_template-corporate/containers/contact.php +++ /dev/null @@ -1,5 +0,0 @@ -ref.'/page185.tpl.php'; -?> diff --git a/htdocs/install/doctemplates/websites/website_template-corporate/containers/faq.php b/htdocs/install/doctemplates/websites/website_template-corporate/containers/faq.php deleted file mode 100644 index 94f01880f4e..00000000000 --- a/htdocs/install/doctemplates/websites/website_template-corporate/containers/faq.php +++ /dev/null @@ -1,5 +0,0 @@ -ref.'/page186.tpl.php'; -?> diff --git a/htdocs/install/doctemplates/websites/website_template-corporate/containers/footer.php b/htdocs/install/doctemplates/websites/website_template-corporate/containers/footer.php deleted file mode 100644 index 533ddc027a2..00000000000 --- a/htdocs/install/doctemplates/websites/website_template-corporate/containers/footer.php +++ /dev/null @@ -1,5 +0,0 @@ -ref.'/page187.tpl.php'; -?> diff --git a/htdocs/install/doctemplates/websites/website_template-corporate/containers/header.php b/htdocs/install/doctemplates/websites/website_template-corporate/containers/header.php deleted file mode 100644 index 831c7ded51a..00000000000 --- a/htdocs/install/doctemplates/websites/website_template-corporate/containers/header.php +++ /dev/null @@ -1,5 +0,0 @@ -ref.'/page188.tpl.php'; -?> diff --git a/htdocs/install/doctemplates/websites/website_template-corporate/containers/home.php b/htdocs/install/doctemplates/websites/website_template-corporate/containers/home.php deleted file mode 100644 index 86a6639e327..00000000000 --- a/htdocs/install/doctemplates/websites/website_template-corporate/containers/home.php +++ /dev/null @@ -1,5 +0,0 @@ -ref.'/page189.tpl.php'; -?> diff --git a/htdocs/install/doctemplates/websites/website_template-corporate/containers/index.php b/htdocs/install/doctemplates/websites/website_template-corporate/containers/index.php deleted file mode 100644 index 5ac34065524..00000000000 --- a/htdocs/install/doctemplates/websites/website_template-corporate/containers/index.php +++ /dev/null @@ -1,11 +0,0 @@ - diff --git a/htdocs/install/doctemplates/websites/website_template-corporate/containers/our-team.php b/htdocs/install/doctemplates/websites/website_template-corporate/containers/our-team.php deleted file mode 100644 index 1afe5d1523d..00000000000 --- a/htdocs/install/doctemplates/websites/website_template-corporate/containers/our-team.php +++ /dev/null @@ -1,5 +0,0 @@ -ref.'/page190.tpl.php'; -?> diff --git a/htdocs/install/doctemplates/websites/website_template-corporate/containers/page179.tpl.php b/htdocs/install/doctemplates/websites/website_template-corporate/containers/page179.tpl.php deleted file mode 100644 index 7a474b5595e..00000000000 --- a/htdocs/install/doctemplates/websites/website_template-corporate/containers/page179.tpl.php +++ /dev/null @@ -1,99 +0,0 @@ - - - -Blog - - - - - - - - - -use_manifest) { print ''."\n"; } ?> - - - - - - - - - - - -
- - - -
-
-
-
-
-
-
-
-
The latest news... -
-
-
-
-
-
-
-
- - -
-

- - load("main"); - $fuser = new User($db); - $arrayofblogs = $websitepage->fetchAll($website->id, 'DESC', 'date_creation', 5, 0, array('type_container'=>'blogpost', 'status'=>1, 'lang'=>'null,'.$websitepage->lang)); - foreach($arrayofblogs as $blog) - { - print ''; - } - ?> -
-
- -

- - - -
- - - - diff --git a/htdocs/install/doctemplates/websites/website_template-corporate/containers/page180.tpl.php b/htdocs/install/doctemplates/websites/website_template-corporate/containers/page180.tpl.php deleted file mode 100644 index 538fc1764e4..00000000000 --- a/htdocs/install/doctemplates/websites/website_template-corporate/containers/page180.tpl.php +++ /dev/null @@ -1,84 +0,0 @@ - - - -Our company is now on Dolibarr ERP CRM - - - - - - - - - -use_manifest) { print ''."\n"; } ?> - - - - - - - - - - - - - - - -
-
-
-
-
-
-
-
-
title; ?> -
-
-
-
-
-
-
-
- -
-


- Like several thousands of companies, our company (name ?>) has moved all its information system to Dolibarr ERP CRM. More than 20 applications have been replaced by only one, easier to use and fully integrated. - This is an important step in improving all of our services. - -


- -
- -

-
Screenshot of our new Open Source solution
-
- - - -





-
- - - - - - - - - diff --git a/htdocs/install/doctemplates/websites/website_template-corporate/containers/page181.tpl.php b/htdocs/install/doctemplates/websites/website_template-corporate/containers/page181.tpl.php deleted file mode 100644 index a8a484ccf44..00000000000 --- a/htdocs/install/doctemplates/websites/website_template-corporate/containers/page181.tpl.php +++ /dev/null @@ -1,85 +0,0 @@ - - - -Our new web site has been launched - - - - - - - - - -use_manifest) { print ''."\n"; } ?> - - - - - - - - - - - - - -
-
-
-
-
-
-
-
-
title; ?> -
-
-
-
-
-
-
-
- -
-





- - - Our new website, based on Dolibarr CMS, has been launched.
- Now it is modern and directly integrated with the internal management tools of the company. Many new online services will be available for our customers... - - -


- -
- -

-
Theme of our new web site
-
- - -





-
- - - - - - - - - - diff --git a/htdocs/install/doctemplates/websites/website_template-corporate/containers/page182.tpl.php b/htdocs/install/doctemplates/websites/website_template-corporate/containers/page182.tpl.php deleted file mode 100644 index 49735b4f21a..00000000000 --- a/htdocs/install/doctemplates/websites/website_template-corporate/containers/page182.tpl.php +++ /dev/null @@ -1,129 +0,0 @@ - - - -Careers - - - - - - - - - -use_manifest) { print ''."\n"; } ?> - - - - - - - - - - - - - - - - - - diff --git a/htdocs/install/doctemplates/websites/website_template-corporate/containers/page183.tpl.php b/htdocs/install/doctemplates/websites/website_template-corporate/containers/page183.tpl.php deleted file mode 100644 index bf4d4c92682..00000000000 --- a/htdocs/install/doctemplates/websites/website_template-corporate/containers/page183.tpl.php +++ /dev/null @@ -1,84 +0,0 @@ - - - -Carrière - - - - - - - - - -use_manifest) { print ''."\n"; } ?> - - - - - - - - - - - -
- - - -
-
-
-
-
-
-
-
-
Offres d'emploi -
-
-
-
-
-
-
-
- - -
-
-
-
-
-Nous n'avons pas d'offres d'emploi ouvertes en ce moment...
-
-
-
-
-
-
- - -

- - - -
- - - - - - diff --git a/htdocs/install/doctemplates/websites/website_template-corporate/containers/page184.tpl.php b/htdocs/install/doctemplates/websites/website_template-corporate/containers/page184.tpl.php deleted file mode 100644 index fca2346bede..00000000000 --- a/htdocs/install/doctemplates/websites/website_template-corporate/containers/page184.tpl.php +++ /dev/null @@ -1,78 +0,0 @@ - - - -Clients Testimonials - - - - - - - - - -use_manifest) { print ''."\n"; } ?> - - - - - - - - - - - -
- - - -
-
-
-
-
-
-
-
-
Testimonials -
-
-
-
-
-
-
-
- - -
-

-

What they say about us

-



- Send us your testimonial (by email to email; ?>) -



-

-
- -

- - - -
- - - - - diff --git a/htdocs/install/doctemplates/websites/website_template-corporate/containers/page185.tpl.php b/htdocs/install/doctemplates/websites/website_template-corporate/containers/page185.tpl.php deleted file mode 100644 index f478da7021f..00000000000 --- a/htdocs/install/doctemplates/websites/website_template-corporate/containers/page185.tpl.php +++ /dev/null @@ -1,84 +0,0 @@ - - - -Contact - - - - - - - - - -use_manifest) { print ''."\n"; } ?> - - - - - - - - - - - -
- - - -
-
-
-
-
-
-
-
-
Contact -
-
-
-
-
-
-
-
- - -
-
-

Contact us:



- email ?>
- getFullAddress() ?>
-
-
- - - -
-
- -
- -


- - - -
- - - - - diff --git a/htdocs/install/doctemplates/websites/website_template-corporate/containers/page186.tpl.php b/htdocs/install/doctemplates/websites/website_template-corporate/containers/page186.tpl.php deleted file mode 100644 index 111e4615774..00000000000 --- a/htdocs/install/doctemplates/websites/website_template-corporate/containers/page186.tpl.php +++ /dev/null @@ -1,91 +0,0 @@ - - - -FAQ - - - - - - - - - -use_manifest) { print ''."\n"; } ?> - - - - - - - - - - - -
- - - -
-
-
-
-
-
-
-
-
FAQs -
-
-
-
-
-
-
-
- - -
-
-


Frequently Asked Questions

-
-
-
-

How can I contact you ?


-You can contact us by using this page. -
-
-
-

What is your privacy policy ?


-You may find information about our privacy policy on this page. - - -



- -
-
- - -

- - - -
- - - - - - diff --git a/htdocs/install/doctemplates/websites/website_template-corporate/containers/page187.tpl.php b/htdocs/install/doctemplates/websites/website_template-corporate/containers/page187.tpl.php deleted file mode 100644 index 615a2214885..00000000000 --- a/htdocs/install/doctemplates/websites/website_template-corporate/containers/page187.tpl.php +++ /dev/null @@ -1,132 +0,0 @@ - - - -Footer - - - - - - - - - -use_manifest) { print ''."\n"; } ?> - - - - - - - - - - - - -
- -
-
-
-
-
-
- -
- -
-
- -
-
- -
-
-
- -
- -
-
- -
-
- - componentSelectLang('auto', $weblangs, 'margin-top-10'); ?> -
-
-
- -
- -
-
-
- -
-
-
- -
-
-
-
getFullAddress(1, '
', 1); ?>
-
-
-
-

Follow Us:

-
    - socialnetworks as $key => $value) { - print '
  • '; - } ?> -
-
-
-
-
-
-
-
- -
-
- Website generated and powered by Dolibarr ERP & CRM -
-
- -
- - - -
- - - - - - - diff --git a/htdocs/install/doctemplates/websites/website_template-corporate/containers/page188.tpl.php b/htdocs/install/doctemplates/websites/website_template-corporate/containers/page188.tpl.php deleted file mode 100644 index 99e9ddd3e9f..00000000000 --- a/htdocs/install/doctemplates/websites/website_template-corporate/containers/page188.tpl.php +++ /dev/null @@ -1,134 +0,0 @@ - - - -Header and Top Menu - - - - - - - - - -use_manifest) { print ''."\n"; } ?> - - - - - - - - - - - - - - - -
-
-
- -
-
-
- - - - diff --git a/htdocs/install/doctemplates/websites/website_template-corporate/containers/page189.tpl.php b/htdocs/install/doctemplates/websites/website_template-corporate/containers/page189.tpl.php deleted file mode 100644 index 3dec20c6b08..00000000000 --- a/htdocs/install/doctemplates/websites/website_template-corporate/containers/page189.tpl.php +++ /dev/null @@ -1,576 +0,0 @@ - - - -Home - - - - - - - - - -use_manifest) { print ''."\n"; } ?> - - - - - - - - - - - -
- - - - - -
-
-
-
-
-
-
-
-
Boost your business -
-
-

We provide powerful solutions for all businesses

-
- -
-
-
-
-
-
-
-
-
-
-
 Best prices on the market  -
-
-

Our optimized processes allows us to provide you very competitive prices

-
- -
-
-
-
-
-
-
-
-
-
-
-
-
- - - - -
-
-
-
-
-
- -
-
-

Our sales representative are also technicians.

-
-
-
-
-
- -
-

Take a look at our offers...

-
-
-
-
-
- -
-

Our customer-supplier relationship is very appreciated by our customers

-
-
-
-
-
-
-
- -
-
-

We continue to follow and assist you after the sale. Contact us at any time.

-
-
-
-
-
- - - -
-
-

Looking for

-

a high quality service?

-

With a lot of experience, hiring us is a security for your business!

-
-
-
11
-
Years of Experience
-
-
-
- query($sql); $obj = $db->fetch_object($resql); print $obj->nb; ?> -
-
Experts
-
-
-
- query($sql); $obj = $db->fetch_object($resql); print $obj->nb; ?> -
-
Trusted Clients
-
-
-
- -
-
-
- - - - -
-
- -
-
- - - -
-
-

our team

-
-
- -
-
-
-
- - - -
-
-
-
-
-

Request a callback

-
-
- -
-
- -
-
- -
-
- -
-
-
-
-
-
-
- - - -
-
-
-
-
-

successful cases

- -
-
-
-
-
- - - -
-
-

Latest News

-
- fetchAll($website->id, 'DESC', 'date_creation', $MAXNEWS, 0, array('type_container'=>'blogpost', 'status'=>1, 'lang'=>'null,'.$websitepage->lang)); - foreach($arrayofblogs as $blog) - { - ?> - - - -
-
-
- - - - - -
- - - - diff --git a/htdocs/install/doctemplates/websites/website_template-corporate/containers/page190.tpl.php b/htdocs/install/doctemplates/websites/website_template-corporate/containers/page190.tpl.php deleted file mode 100644 index 63255c34db5..00000000000 --- a/htdocs/install/doctemplates/websites/website_template-corporate/containers/page190.tpl.php +++ /dev/null @@ -1,115 +0,0 @@ - - - -Our team - - - - - - - - - -use_manifest) { print ''."\n"; } ?> - - - - - - - - - - - -
- - - -
-
-
-
-
-
-
-
-
Our team -
-
-
-
-
-
-
-
- - -
-

-

The crew...




- query($sql); - if (! $resql) dol_print_error($db); - while ($obj = $db->fetch_object($resql)) - { - $arrayofusers[]=$obj->rowid; - } - - print '
'; - foreach($arrayofusers as $id) - { - $fuser->fetch($id); - - print '
'; - print '
'; - print '
'; - if ($fuser->photo) print Form::showphoto('userphoto', $fuser, 100, 0, 0, 'photowithmargin', '', 0); - //print ''; - else print ''; - print '
'; - print '
'; - print '
'.$fuser->firstname.'
'; - print '
    '; - //print '
  • September 24, 2018
  • '; - if ($fuser->job) print '
  • '.$fuser->job.'
  • '; - else print '
  • '; - print '
'; - print '
'; - print '
'; - print '
'; - } - print '
'; - - ?> -
-
- -

- - - -
- - - - - diff --git a/htdocs/install/doctemplates/websites/website_template-corporate/containers/page191.tpl.php b/htdocs/install/doctemplates/websites/website_template-corporate/containers/page191.tpl.php deleted file mode 100644 index b52ee75825e..00000000000 --- a/htdocs/install/doctemplates/websites/website_template-corporate/containers/page191.tpl.php +++ /dev/null @@ -1,110 +0,0 @@ - - - -Partners - - - - - - - - - -use_manifest) { print ''."\n"; } ?> - - - - - - - - - - - -
- - - -
-
-
-
-
-
-
-
-
Partners -
-
-
-
-
-
-
-
- - -
-
-

Our partners...

-
-
-
-
-
- -
-
-
-
- -
-
-
-
-
- -
-
-
-
-
- -
-
-
-
-
-
-
-
-
- - -

- - - -
- - - - - - diff --git a/htdocs/install/doctemplates/websites/website_template-corporate/containers/page192.tpl.php b/htdocs/install/doctemplates/websites/website_template-corporate/containers/page192.tpl.php deleted file mode 100644 index 3344e971e80..00000000000 --- a/htdocs/install/doctemplates/websites/website_template-corporate/containers/page192.tpl.php +++ /dev/null @@ -1,186 +0,0 @@ - - - -Pricing - - - - - - - - - -use_manifest) { print ''."\n"; } ?> - - - - - - - - - - - -
- - - -
-
-
-
-
-
-
-
-
Our plans -
-
-
-
-
-
-
-
- - - - - -
-
- -
-
- - - -

- - - -
- - - - - diff --git a/htdocs/install/doctemplates/websites/website_template-corporate/containers/page193.tpl.php b/htdocs/install/doctemplates/websites/website_template-corporate/containers/page193.tpl.php deleted file mode 100644 index 4e6f65e80a5..00000000000 --- a/htdocs/install/doctemplates/websites/website_template-corporate/containers/page193.tpl.php +++ /dev/null @@ -1,100 +0,0 @@ - - - -Privacy Policies - - - - - - - - - -use_manifest) { print ''."\n"; } ?> - - - - - - - - - - - -
- - - - - -
-
-
-
-
-
-
-
-
Privacy Policy -
-
-
-
-
-
-
-
- -


- -
-
-

Information collected and used


-

* Your customer information (email, phone, business name, first and last name of contact, address, postal code, country and VAT number) are stored when you become a customer. This information allows us to bill you. -

* If you paid using our online service, we also store the last 4 digits of your card. The full details of your credit card is stored by our payment provider Stripe (the world leader in online payment).

-

* You have the option to request the deletion of your data and the above information at any time (except data required y fiscal tracking rules, like your invoices).

-

* The Privacy Policies and GDPR referral contact for our services is: global->MAIN_INFO_GDPR; ?>

-


-

Data Storage and Backups


-

* The storage of collected data (see 'Information collected and used') is done in a database.

-

* We made one backup every week. Only 4 weeks are kept.

-


-

Subcontractor


-

* Our services relies on the following subcontractors and service:
-** The host of computer servers, which is ABC company. These servers are hosted in US. No customer information is communicated to this subcontractor who only provides the hardware and network layer, the installation and operation being carried out by us directly.
-** The online payment service Stripe, which is used, to ensure regular payment of subscription or your invoices paid online.

-


-

Software Protection


-

* Our services runs on Linux Ubuntu systems and software. They benefit from regular security updates when the operating system editor (Ubuntu Canonical) publishes them.

-

* Our services are accessible in HTTPS (HTTP encrypted) only, encrypted with SHA256 certificates.

-

* Our technical platform are protected by various solutions.

-


-

Data theft


-

* In case of suspicion of a theft of the data we have collected (see first point 'Information collected and used'), customers will be informed by email, at email corresponding to their customer account

-

 

-
-
- - - - - -
- - - - - diff --git a/htdocs/install/doctemplates/websites/website_template-corporate/containers/page194.tpl.php b/htdocs/install/doctemplates/websites/website_template-corporate/containers/page194.tpl.php deleted file mode 100644 index e4aa79e1291..00000000000 --- a/htdocs/install/doctemplates/websites/website_template-corporate/containers/page194.tpl.php +++ /dev/null @@ -1,84 +0,0 @@ - - - -Product P - - - - - - - - - -use_manifest) { print ''."\n"; } ?> - - - - - - - - - - - -
- - - -
-
-
-
-
-
-
-
-
Product P -
-
-
-
-
-
-
-
- - -
-
-
-
-
-This is a description page of our product P...
-
-
-
-
-
-
- - -

- - - -
- - - - - - diff --git a/htdocs/install/doctemplates/websites/website_template-corporate/containers/page195.tpl.php b/htdocs/install/doctemplates/websites/website_template-corporate/containers/page195.tpl.php deleted file mode 100644 index 0e1774d931b..00000000000 --- a/htdocs/install/doctemplates/websites/website_template-corporate/containers/page195.tpl.php +++ /dev/null @@ -1,112 +0,0 @@ - - - -Search Page - - - - - - - - - -use_manifest) { print ''."\n"; } ?> - - - - - - - - - - - -
- - - -
-
-
-
-
-
-
-
-
Search -
-
-
-
-
-
-
-
- -


- -
- -
- -
-
- - load("main"); - - if (function_exists('getPagesFromSearchCriterias')) - { - if (GETPOSTISSET('s')) - { - $listofpages = getPagesFromSearchCriterias('page', 'meta', GETPOST('s', 'alphanohtml')); - if ($listofpages['code'] == 'OK') - { - foreach($listofpages['list'] as $websitepagefound) - { - print '
'.$websitepagefound->title.' - '.$websitepagefound->description.'
'; - } - } - else - { - // If error, show message - print $listofpages['message']; - } - } - } - else - { - print $weblangs->trans("FeatureNotYetAvailable"); - } - ?> - -





-
- - - -
- - - - diff --git a/htdocs/install/doctemplates/websites/website_template-corporate/containers/page196.tpl.php b/htdocs/install/doctemplates/websites/website_template-corporate/containers/page196.tpl.php deleted file mode 100644 index d52718bcfc8..00000000000 --- a/htdocs/install/doctemplates/websites/website_template-corporate/containers/page196.tpl.php +++ /dev/null @@ -1,82 +0,0 @@ - - - -Service S - - - - - - - - - -use_manifest) { print ''."\n"; } ?> - - - - - - - - - - - -
- - - -
-
-
-
-
-
-
-
-
Service S -
-
-
-
-
-
-
-
- - -
-
-
-
-
-This is a description page of our service S...
-
-
-
-
-
-
- - -

- - - -
- - - - diff --git a/htdocs/install/doctemplates/websites/website_template-corporate/containers/partners.php b/htdocs/install/doctemplates/websites/website_template-corporate/containers/partners.php deleted file mode 100644 index 44e501d9f4d..00000000000 --- a/htdocs/install/doctemplates/websites/website_template-corporate/containers/partners.php +++ /dev/null @@ -1,5 +0,0 @@ -ref.'/page191.tpl.php'; -?> diff --git a/htdocs/install/doctemplates/websites/website_template-corporate/containers/pricing.php b/htdocs/install/doctemplates/websites/website_template-corporate/containers/pricing.php deleted file mode 100644 index d2866cadf43..00000000000 --- a/htdocs/install/doctemplates/websites/website_template-corporate/containers/pricing.php +++ /dev/null @@ -1,5 +0,0 @@ -ref.'/page192.tpl.php'; -?> diff --git a/htdocs/install/doctemplates/websites/website_template-corporate/containers/privacy-policies.php b/htdocs/install/doctemplates/websites/website_template-corporate/containers/privacy-policies.php deleted file mode 100644 index 59dc87944fe..00000000000 --- a/htdocs/install/doctemplates/websites/website_template-corporate/containers/privacy-policies.php +++ /dev/null @@ -1,5 +0,0 @@ -ref.'/page193.tpl.php'; -?> diff --git a/htdocs/install/doctemplates/websites/website_template-corporate/containers/product-p.php b/htdocs/install/doctemplates/websites/website_template-corporate/containers/product-p.php deleted file mode 100644 index beac94b27c8..00000000000 --- a/htdocs/install/doctemplates/websites/website_template-corporate/containers/product-p.php +++ /dev/null @@ -1,5 +0,0 @@ -ref.'/page194.tpl.php'; -?> diff --git a/htdocs/install/doctemplates/websites/website_template-corporate/containers/search.php b/htdocs/install/doctemplates/websites/website_template-corporate/containers/search.php deleted file mode 100644 index 359c5bf3b26..00000000000 --- a/htdocs/install/doctemplates/websites/website_template-corporate/containers/search.php +++ /dev/null @@ -1,5 +0,0 @@ -ref.'/page195.tpl.php'; -?> diff --git a/htdocs/install/doctemplates/websites/website_template-corporate/containers/service-s.php b/htdocs/install/doctemplates/websites/website_template-corporate/containers/service-s.php deleted file mode 100644 index f69f6e7a13e..00000000000 --- a/htdocs/install/doctemplates/websites/website_template-corporate/containers/service-s.php +++ /dev/null @@ -1,5 +0,0 @@ -ref.'/page196.tpl.php'; -?> diff --git a/htdocs/install/doctemplates/websites/website_template-corporate/containers/test2.php b/htdocs/install/doctemplates/websites/website_template-corporate/containers/test2.php deleted file mode 100644 index 9939ba32bf6..00000000000 --- a/htdocs/install/doctemplates/websites/website_template-corporate/containers/test2.php +++ /dev/null @@ -1,4 +0,0 @@ -ref.'/page126.tpl.php'; diff --git a/htdocs/install/doctemplates/websites/website_template-homesubmenu/containers/index.php b/htdocs/install/doctemplates/websites/website_template-homesubmenu/containers/index.php deleted file mode 100644 index 967c5deb878..00000000000 --- a/htdocs/install/doctemplates/websites/website_template-homesubmenu/containers/index.php +++ /dev/null @@ -1,5 +0,0 @@ -ref.'/page202.tpl.php'; -?> diff --git a/htdocs/install/doctemplates/websites/website_template-homesubmenu/containers/page202.tpl.php b/htdocs/install/doctemplates/websites/website_template-homesubmenu/containers/page202.tpl.php deleted file mode 100644 index 11a32b36968..00000000000 --- a/htdocs/install/doctemplates/websites/website_template-homesubmenu/containers/page202.tpl.php +++ /dev/null @@ -1,315 +0,0 @@ - - - -Home page - - - - - - - - - -use_manifest) { print ''."\n"; } ?> - - - - - - - - - - - - -email; - $message = GETPOST('message', 'alpha'); - $cmail = new CMailFile('Contact from website', $to, $from, $message); - if ($cmail->sendfile()) { - ?> - - trans("ErrorFailedToSendMail", $from, $to).'. '.$cmail->error; - } -} -?> -
- - -
-
-
-
-

Get Productive

-

- Lorem ipsum dolor, sit amet consectetur adipisicing - elit. Ab fuga nobis omnis alias, aliquid iste cumque - tempora nim reprehenderit quia itaque debitis, - nostrum labore rerum reiciendis laboriosam unde, - tempore corporis. -

- landing-img -
- - Learn More - -
-
-
-
-
-
-
-

- LOREM IPSUM DOLOR SIT AMET EZAJB -

- article -
-
-

Our Company

-

- Lorem ipsum dolor, sit amet consectetur adipisicing - elit. Ab fuga nobis omnis alias, aliquid iste cumque - tempora nim reprehenderit quia itaque debitis, - nostrum labore rerum reiciendis laboriosam unde, - tempore corporis. -

-
-
-
-
-
-
-
-
-

Founders

-
    -
  • -

    Author One

    -
  • -
  • -

    Author Two

    -
  • -
  • -

    Author Three

    -
  • -
  • -

    Author Four

    -
  • -
-
-
-

About

-

- Lorem ipsum dolor sit amet consectetur adipisicing elit. Veritatis accusantium earum sed odit velit laudantium ex libero quisquam consectetur, - dolorem vero ipsam perferendis quibusdam itaque omnis a consequatur error repellat. -

-
-
-
-
- -
-

Contact us

- -

Do you have any questions? Please do not hesitate to contact us directly. Our team will come back to you within - a matter of hours to help you.

- -
- - -
-
- - -
-
-
- - -
-
- - -
-
- - -
-
-
-
- - -
-
-
-
- -
-
-
-
- - -
-
-
    -
  • -

    getFullAddress() ?>

    -
  • - -
  • -

    phone ?>

    -
  • - -
  • -

    email ?>

    -
  • -
-
- -
- - -
-
- -
- - - - diff --git a/htdocs/install/doctemplates/websites/website_template-noimg/containers/index.php b/htdocs/install/doctemplates/websites/website_template-noimg/containers/index.php deleted file mode 100644 index 64331a0ec08..00000000000 --- a/htdocs/install/doctemplates/websites/website_template-noimg/containers/index.php +++ /dev/null @@ -1,4 +0,0 @@ -ref.'/page80.tpl.php'; diff --git a/htdocs/install/doctemplates/websites/website_template-noimg/containers/page80.tpl.php b/htdocs/install/doctemplates/websites/website_template-noimg/containers/page80.tpl.php deleted file mode 100644 index 742993e5a85..00000000000 --- a/htdocs/install/doctemplates/websites/website_template-noimg/containers/page80.tpl.php +++ /dev/null @@ -1,331 +0,0 @@ - - - -index - - - - - - - - - -use_manifest) { print ''."\n"; } ?> - - - - - - - - - - - - - - - - - - - Template - - - - - -email; - $message = GETPOST('message', 'alpha'); - $cmail = new CMailFile('Contact from website', $to, $from, $message); - if ($cmail->sendfile()) { - ?> - - trans("ErrorFailedToSendMail", $from, $to).'. '.$cmail->error; - } -} -?> -
-
- - -
-
- -
-
-
-

- Brand - Name -

-

- Hello fellows, here is a description of the - brand -

- - - -
-
-
-
- -
-
-
-
-

Products

-
-
-
-
-
- -
-

Product 1

-

- Some quick example text to build on the - card title and make up the bulk of the - card's content. -

- - - -
-
-
-
-
- -
-

Product 2

-

- Some quick example text to build on the - card title and make up the bulk of the - card's content. -

- - - -
-
-
-
-
- -
-

Product 3

-

- Some quick example text to build on the - card title and make up the bulk of the - card's content. -

- - - -
-
-
-
-
- -
-

Product 4

-

- Some quick example text to build on the - card title and make up the bulk of the - card's content. -

- - - -
-
-
-
-
- -
-

Product 5

-

- Some quick example text to build on the - card title and make up the bulk of the - card's content. -

- - - -
-
-
-
-
- -
-

Product 6

-

- Some quick example text to build on the - card title and make up the bulk of the - card's content. -

- - - -
-
-
-
-
-
- -
-
-
-

Contact us

-

- Email: email ?> -

-

- Phone-number: phone ?> -

-
-
-

- Or complete the form -

-
-
- - -
-
-
- - -
-
- - -
-
- - -
-
-
-
- - -
-
-
-
- -
-
-
-
-
-
- -
- - - - diff --git a/htdocs/install/doctemplates/websites/website_template-onepageblackpurple/containers/index.php b/htdocs/install/doctemplates/websites/website_template-onepageblackpurple/containers/index.php deleted file mode 100644 index b4e33361f1b..00000000000 --- a/htdocs/install/doctemplates/websites/website_template-onepageblackpurple/containers/index.php +++ /dev/null @@ -1,4 +0,0 @@ -ref.'/page148.tpl.php'; diff --git a/htdocs/install/doctemplates/websites/website_template-onepageblackpurple/containers/page148.tpl.php b/htdocs/install/doctemplates/websites/website_template-onepageblackpurple/containers/page148.tpl.php deleted file mode 100644 index 97f91ac61df..00000000000 --- a/htdocs/install/doctemplates/websites/website_template-onepageblackpurple/containers/page148.tpl.php +++ /dev/null @@ -1,296 +0,0 @@ - - - -index - - - - - - - - - -use_manifest) { print ''."\n"; } ?> - - - - - - - - - - - - - - - - - - - Template - - - - - -
-
-
-
-
-
-

Our company

-

- Lorem ipsum dolor, sit amet consectetur adipisicing elit. Nostrum excepturi ipsa consequatur accusamus eveniet dignissimos necessitatibus provident dolore cupiditate. -

-
-

- It uses utility classes for typography and spacing to space content out within the - larger container. -

-

- - - - - - -

-
-
-
- landingpage -
-
-
-
- -
-
-
-
-
- ... -
-

LoremIpsum

-

- Some quick example text to build on the - card title and make up the bulk of the - card's content. -

- -
-
-
-
-
-
-
- ... -
-

LoremIpsum

-

- Some quick example text to build on the - card title and make up the bulk of the - card's content. -

- -
-
-
-
-
-
-
- ... -
-

LoremIpsum

-

- Some quick example text to build on the - card title and make up the bulk of the - card's content. -

- -
-
-
-
-
-
-
- ... -
-

LoremIpsum

-

- Some quick example text to build on the - card title and make up the bulk of the - card's content. -

- -
-
-
-
-
-
-
- ... -
-

LoremIpsum

-

- Some quick example text to build on the - card title and make up the bulk of the - card's content. -

- -
-
-
-
-
-
-
- ... -
-

LoremIpsum

-

- Some quick example text to build on the - card title and make up the bulk of the - card's content. -

- -
-
-
-
-
-
-
-
-
-
-

UNLIMITED FOR ALL

-

Lorem, ipsum dolor sit amet consectetur adipisicing elit. Minus molestias voluptatibus voluptatem Lorem ipsum dolor, sit amet consectetur adipisicing elit. Veritatis officia voluptatem incidunt tempore esse porro sequi eveniet eum corrupti quo.

-
-
-

$79/month

-
-
-

WHAT YOU WILL GET

-

Lorem ipsum dolor sit, amet consectetur


-

Lorem ipsum dolor sit, amet consectetur


-

Lorem ipsum dolor sit, amet consectetur


- - - -
-
-
-
-
-
-
-
-
-
-
-

Contact us

-
-
- email ?>
- getFullAddress() ?>
-
-
- - -
-
- -
- -


- -
-
-
-
-
-
- -
- -
- socialnetworks as $key => $value) { - print ''; - } ?> - -
- -
- - - -
- © 2022 Dolibarr: - Dolicloud.com -
- -
-
- - - - diff --git a/htdocs/install/doctemplates/websites/website_template-restaurant/containers/about.php b/htdocs/install/doctemplates/websites/website_template-restaurant/containers/about.php deleted file mode 100644 index 560719a4fda..00000000000 --- a/htdocs/install/doctemplates/websites/website_template-restaurant/containers/about.php +++ /dev/null @@ -1,5 +0,0 @@ -ref.'/page248.tpl.php'; -?> diff --git a/htdocs/install/doctemplates/websites/website_template-restaurant/containers/contact.php b/htdocs/install/doctemplates/websites/website_template-restaurant/containers/contact.php deleted file mode 100644 index e3a18e3b92d..00000000000 --- a/htdocs/install/doctemplates/websites/website_template-restaurant/containers/contact.php +++ /dev/null @@ -1,5 +0,0 @@ -ref.'/page249.tpl.php'; -?> diff --git a/htdocs/install/doctemplates/websites/website_template-restaurant/containers/footer.php b/htdocs/install/doctemplates/websites/website_template-restaurant/containers/footer.php deleted file mode 100644 index 4052f2ff8e9..00000000000 --- a/htdocs/install/doctemplates/websites/website_template-restaurant/containers/footer.php +++ /dev/null @@ -1,5 +0,0 @@ -ref.'/page252.tpl.php'; -?> diff --git a/htdocs/install/doctemplates/websites/website_template-restaurant/containers/header.php b/htdocs/install/doctemplates/websites/website_template-restaurant/containers/header.php deleted file mode 100644 index 530e4397e93..00000000000 --- a/htdocs/install/doctemplates/websites/website_template-restaurant/containers/header.php +++ /dev/null @@ -1,5 +0,0 @@ -ref.'/page253.tpl.php'; -?> diff --git a/htdocs/install/doctemplates/websites/website_template-restaurant/containers/index.php b/htdocs/install/doctemplates/websites/website_template-restaurant/containers/index.php deleted file mode 100644 index 08ce45517af..00000000000 --- a/htdocs/install/doctemplates/websites/website_template-restaurant/containers/index.php +++ /dev/null @@ -1,5 +0,0 @@ -ref.'/page250.tpl.php'; -?> diff --git a/htdocs/install/doctemplates/websites/website_template-restaurant/containers/menu.php b/htdocs/install/doctemplates/websites/website_template-restaurant/containers/menu.php deleted file mode 100644 index 57315e4da18..00000000000 --- a/htdocs/install/doctemplates/websites/website_template-restaurant/containers/menu.php +++ /dev/null @@ -1,5 +0,0 @@ -ref.'/page251.tpl.php'; -?> diff --git a/htdocs/install/doctemplates/websites/website_template-restaurant/containers/page248.tpl.php b/htdocs/install/doctemplates/websites/website_template-restaurant/containers/page248.tpl.php deleted file mode 100644 index 9acf79aaec9..00000000000 --- a/htdocs/install/doctemplates/websites/website_template-restaurant/containers/page248.tpl.php +++ /dev/null @@ -1,113 +0,0 @@ - - - -About us - - - - - - - - - -use_manifest) { print ''."\n"; } ?> - - - - - - - - - - - - - - -
-
- - - -
-
-
- -
-

Team Members

-
- -
-
- - -
-

Sophia

- -

CEO & Founder

-
-
-
- -
-
- - -

Benjamin W.

- -

Restaurant Manager

-
-
- -
-
- - -

Muchen Jack

- -

Senior Chef

-
-
- -
-
-
- -
- -
- - - - - - - - diff --git a/htdocs/install/doctemplates/websites/website_template-restaurant/containers/page249.tpl.php b/htdocs/install/doctemplates/websites/website_template-restaurant/containers/page249.tpl.php deleted file mode 100644 index faf8513d064..00000000000 --- a/htdocs/install/doctemplates/websites/website_template-restaurant/containers/page249.tpl.php +++ /dev/null @@ -1,368 +0,0 @@ - - - -Contact us - - - - - - - - - -use_manifest) { print ''."\n"; } ?> - - - - - - - - - - - - -email; - $message = GETPOST('message', 'alpha'); - $cmail = new CMailFile('Contact from website', $to, $from, $message); - if ($cmail->sendfile()) { - ?> - - trans("ErrorFailedToSendMail", $from, $to).'. '.$cmail->error; - } -} -?> - - - - -
-
- - -
- -
-
-
-
-

Leave a message

-
- -
-
- - - -
- - - -
- -
- - - -
- -
- - - - - - - -
- -
- -
-
-
- -
-
Weekdays
- -
- $day : " .getDolGlobalString("MAIN_INFO_OPENINGHOURS_$day") ."

"; - } - ?> -
- -
Weekends
- -
-

Saturday and Sunday

- -

to be determined !

-
-
- -
-

- -

- getFullAddress() ?> -

- - -
-
- -
-
-
-
-
-
- - - - - - -
- - - - - - - - diff --git a/htdocs/install/doctemplates/websites/website_template-restaurant/containers/page250.tpl.php b/htdocs/install/doctemplates/websites/website_template-restaurant/containers/page250.tpl.php deleted file mode 100644 index ed509115c54..00000000000 --- a/htdocs/install/doctemplates/websites/website_template-restaurant/containers/page250.tpl.php +++ /dev/null @@ -1,475 +0,0 @@ - - - -index - - - - - - - - - -use_manifest) { print ''."\n"; } ?> - - - - - - - - - - - - - - - - -
-
-
-
-
-
-
-

- Delicious Steaks -

- -
-
-
- - - - - -
-
-
-
-
- -
- -
-
-
- -
-
- - -
- -
- - - - - - - diff --git a/htdocs/install/doctemplates/websites/website_template-restaurant/containers/page251.tpl.php b/htdocs/install/doctemplates/websites/website_template-restaurant/containers/page251.tpl.php deleted file mode 100644 index 50fb446dd2e..00000000000 --- a/htdocs/install/doctemplates/websites/website_template-restaurant/containers/page251.tpl.php +++ /dev/null @@ -1,273 +0,0 @@ - - - -Our menus - - - - - - - - - -use_manifest) { print ''."\n"; } ?> - - - - - - - - - - - - - - - - -
-
- - - - - - - -
- -
- - - - - - - diff --git a/htdocs/install/doctemplates/websites/website_template-restaurant/containers/page252.tpl.php b/htdocs/install/doctemplates/websites/website_template-restaurant/containers/page252.tpl.php deleted file mode 100644 index 568a538488b..00000000000 --- a/htdocs/install/doctemplates/websites/website_template-restaurant/containers/page252.tpl.php +++ /dev/null @@ -1,93 +0,0 @@ - - - -Footer - - - - - - - - - -use_manifest) { print ''."\n"; } ?> - - - - - - - - - - - - - - - - - diff --git a/htdocs/install/doctemplates/websites/website_template-restaurant/containers/page253.tpl.php b/htdocs/install/doctemplates/websites/website_template-restaurant/containers/page253.tpl.php deleted file mode 100644 index 10896678ceb..00000000000 --- a/htdocs/install/doctemplates/websites/website_template-restaurant/containers/page253.tpl.php +++ /dev/null @@ -1,98 +0,0 @@ - - - -Header - - - - - - - - - -use_manifest) { print ''."\n"; } ?> - - - - - - - - - - - - - - - - - diff --git a/htdocs/install/doctemplates/websites/website_template-stellar/containers/credits.php b/htdocs/install/doctemplates/websites/website_template-stellar/containers/credits.php deleted file mode 100644 index 9413220a642..00000000000 --- a/htdocs/install/doctemplates/websites/website_template-stellar/containers/credits.php +++ /dev/null @@ -1,4 +0,0 @@ -ref.'/page20.tpl.php'; diff --git a/htdocs/install/doctemplates/websites/website_template-stellar/containers/footer.php b/htdocs/install/doctemplates/websites/website_template-stellar/containers/footer.php deleted file mode 100644 index f49ea9820eb..00000000000 --- a/htdocs/install/doctemplates/websites/website_template-stellar/containers/footer.php +++ /dev/null @@ -1,4 +0,0 @@ -ref.'/page21.tpl.php'; diff --git a/htdocs/install/doctemplates/websites/website_template-stellar/containers/generic.php b/htdocs/install/doctemplates/websites/website_template-stellar/containers/generic.php deleted file mode 100644 index 125a586cbbf..00000000000 --- a/htdocs/install/doctemplates/websites/website_template-stellar/containers/generic.php +++ /dev/null @@ -1,4 +0,0 @@ -ref.'/page22.tpl.php'; diff --git a/htdocs/install/doctemplates/websites/website_template-stellar/containers/home.php b/htdocs/install/doctemplates/websites/website_template-stellar/containers/home.php deleted file mode 100644 index 17b2d2fcb5e..00000000000 --- a/htdocs/install/doctemplates/websites/website_template-stellar/containers/home.php +++ /dev/null @@ -1,4 +0,0 @@ -ref.'/page23.tpl.php'; diff --git a/htdocs/install/doctemplates/websites/website_template-stellar/containers/index.php b/htdocs/install/doctemplates/websites/website_template-stellar/containers/index.php deleted file mode 100644 index 3f2d97e57ac..00000000000 --- a/htdocs/install/doctemplates/websites/website_template-stellar/containers/index.php +++ /dev/null @@ -1,11 +0,0 @@ -ref.'/page24.tpl.php'; diff --git a/htdocs/install/doctemplates/websites/website_template-stellar/containers/page20.tpl.php b/htdocs/install/doctemplates/websites/website_template-stellar/containers/page20.tpl.php deleted file mode 100644 index ace3135f312..00000000000 --- a/htdocs/install/doctemplates/websites/website_template-stellar/containers/page20.tpl.php +++ /dev/null @@ -1,75 +0,0 @@ - - - -Credits - - - - - - - - - -use_manifest) { print ''."\n"; } ?> - - - - - - - - - - - - - -
- - - - - - - - -
- - -
- -

- -This site is edited by name; ?> - - -

- -
- -
- - - - -
- - - - - diff --git a/htdocs/install/doctemplates/websites/website_template-stellar/containers/page21.tpl.php b/htdocs/install/doctemplates/websites/website_template-stellar/containers/page21.tpl.php deleted file mode 100644 index 9cbab5789c9..00000000000 --- a/htdocs/install/doctemplates/websites/website_template-stellar/containers/page21.tpl.php +++ /dev/null @@ -1,91 +0,0 @@ - - - -Footer - - - - - - - - - -use_manifest) { print ''."\n"; } ?> - - - - - - - - - - - - -
-
-

Aliquam sed mauris

-

Sed lorem ipsum dolor sit amet et nullam consequat feugiat consequat magna adipiscing tempus etiam dolore veroeros. eget dapibus mauris. Cras aliquet, nisl ut viverra sollicitudin, ligula erat egestas velit, vitae tincidunt odio.

- -
-
-

Etiam feugiat

-
-
Address
-
getFullAddress(1, '
'); ?>
-
Phone
-
phone; ?>
-
Email
-
email; ?>
-
-
- -
- - - - - - - - - diff --git a/htdocs/install/doctemplates/websites/website_template-stellar/containers/page22.tpl.php b/htdocs/install/doctemplates/websites/website_template-stellar/containers/page22.tpl.php deleted file mode 100644 index 87bf7faf346..00000000000 --- a/htdocs/install/doctemplates/websites/website_template-stellar/containers/page22.tpl.php +++ /dev/null @@ -1,119 +0,0 @@ - - - -Generic page - - - - - - - - - -use_manifest) { print ''."\n"; } ?> - - - - - - - - - - - - - -
- - - - - - - - -
- - -
- -

Magna feugiat lorem

-

Donec eget ex magna. Interdum et malesuada fames ac ante ipsum primis in faucibus. Pellentesque venenatis dolor imperdiet dolor mattis sagittis. Praesent rutrum sem diam, vitae egestas enim auctor sit amet. Pellentesque leo mauris, consectetur id ipsum sit amet, fergiat. Pellentesque in mi eu massa lacinia malesuada et a elit. Donec urna ex, lacinia in purus ac, pretium pulvinar mauris. Curabitur sapien risus, commodo eget turpis at, elementum convallis fames ac ante ipsum primis in faucibus.

-

Pellentesque venenatis dolor imperdiet dolor mattis sagittis. Praesent rutrum sem diam, vitae egestas enim auctor sit amet.

-

Tempus veroeros

-

Cep risus aliquam gravida cep ut lacus amet. Adipiscing faucibus nunc placerat. Tempus adipiscing turpis non blandit accumsan eget lacinia nunc integer interdum amet aliquam ut orci non col ut ut praesent.

-
- - -
-

Latest Blog posts

-
- loadLangs(array("main","website")); - $fuser = new User($db); - $arrayofblogs = $websitepage->fetchAll($website->id, 'DESC', 'date_creation', 5, 0, array('type_container'=>'blogpost', 'status'=>1, 'lang'=>'null,'.$websitepage->lang)); // , 'keywords'=>$keyword - if (is_numeric($arrayofblogs) && $arrayofblogs < 0) { - print '
'.$weblangs->trans($websitepage->error).'
'; - } elseif (is_array($arrayofblogs) && ! empty($arrayofblogs)) { - foreach ($arrayofblogs as $blog) { - print ''; - } - } else { - print '
'; - print '
'; - //print $weblangs->trans("NoArticlesFoundForTheKeyword", $keyword); - print $weblangs->trans("NoArticlesFound"); - print '
'; - print '
'; - } - ?> -
-
- -
- - - - - - - -
- - - - - diff --git a/htdocs/install/doctemplates/websites/website_template-stellar/containers/page23.tpl.php b/htdocs/install/doctemplates/websites/website_template-stellar/containers/page23.tpl.php deleted file mode 100644 index bd1eda51e55..00000000000 --- a/htdocs/install/doctemplates/websites/website_template-stellar/containers/page23.tpl.php +++ /dev/null @@ -1,163 +0,0 @@ - - - -My personal blog - - - - - - - - - -use_manifest) { print ''."\n"; } ?> - - - - - - - - - - - - -
- - - - - - - - -
- - -
-
-
-
-

Ipsum sed adipiscing

-
-

Sed lorem ipsum dolor sit amet nullam consequat feugiat consequat magna - adipiscing magna etiam amet veroeros. Lorem ipsum dolor tempus sit cursus. - Tempus nisl et nullam lorem ipsum dolor sit amet aliquam.

- -
- -
-
- - -
-
-

Magna veroeros

-
-
    -
  • - -

    Ipsum consequat

    -

    Sed lorem amet ipsum dolor et amet nullam consequat a feugiat consequat tempus veroeros sed consequat.

    -
  • -
  • - -

    Amed sed feugiat

    -

    Sed lorem amet ipsum dolor et amet nullam consequat a feugiat consequat tempus veroeros sed consequat.

    -
  • -
  • - -

    Dolor nullam

    -

    Sed lorem amet ipsum dolor et amet nullam consequat a feugiat consequat tempus veroeros sed consequat.

    -
  • -
- -
- - -
-
-

Ipsum consequat

-

Donec imperdiet consequat consequat. Suspendisse feugiat congue
- posuere. Nulla massa urna, fermentum eget quam aliquet.

-
-
    -
  • - - 5,120 Etiam -
  • -
  • - - 8,192 Magna -
  • -
  • - - 2,048 Tempus -
  • -
  • - - 4,096 Aliquam -
  • -
  • - - 1,024 Nullam -
  • -
-

Nim elementum nisl et mi a commodo porttitor. Morbi sit amet nisl eu arcu faucibus hendrerit vel a risus. Nim a orci mi, elementum ac arcu sit amet, fermentum pellentesque et purus. Integer maximus varias lorem, sed convallis diam accumsan sed. Etiam porttitor placerat sapien, sed eleifend a enim pulvinar faucibus semper quis ut arcu. Ut non nisl a mollis est efficitur vestibulum. Integer eget purus nec nulla mattis et accumsan ut magna libero. Morbi auctor iaculis porttitor. Sed ut magna ac risus et hendrerit scelerisque. Praesent eleifend lacus in lectus aliquam porta. Cras eu ornare dui curabitur lacinia.

- -
- - -
-
-

Congue imperdiet

-

Donec imperdiet consequat consequat. Suspendisse feugiat congue
- posuere. Nulla massa urna, fermentum eget quam aliquet.

-
- -
- -
- - - -
- - - - - diff --git a/htdocs/install/doctemplates/websites/website_template-stellar/containers/page24.tpl.php b/htdocs/install/doctemplates/websites/website_template-stellar/containers/page24.tpl.php deleted file mode 100644 index 3ea7a55dbd5..00000000000 --- a/htdocs/install/doctemplates/websites/website_template-stellar/containers/page24.tpl.php +++ /dev/null @@ -1,48 +0,0 @@ - - - -Menu - - - - - - - - - -use_manifest) { print ''."\n"; } ?> - - - - - - - - - - - - - - - - diff --git a/htdocs/install/doctemplates/websites/website_template-stellar/containers/page25.tpl.php b/htdocs/install/doctemplates/websites/website_template-stellar/containers/page25.tpl.php deleted file mode 100644 index ec9e02f4914..00000000000 --- a/htdocs/install/doctemplates/websites/website_template-stellar/containers/page25.tpl.php +++ /dev/null @@ -1,44 +0,0 @@ - - - -This is a Blog post - - - - - - - - - -use_manifest) { print ''."\n"; } ?> - - - - - - - - - - - - -
- This is a blog post article... -
- - - - diff --git a/htdocs/install/doctemplates/websites/website_template-stellar/containers/this-is-a-blog-post.php b/htdocs/install/doctemplates/websites/website_template-stellar/containers/this-is-a-blog-post.php deleted file mode 100644 index 0b70a249b2c..00000000000 --- a/htdocs/install/doctemplates/websites/website_template-stellar/containers/this-is-a-blog-post.php +++ /dev/null @@ -1,4 +0,0 @@ -ref.'/page25.tpl.php'; diff --git a/htdocs/install/mysql/migration/19.0.0-20.0.0.sql b/htdocs/install/mysql/migration/19.0.0-20.0.0.sql index 335c493c6cf..233ffab3b55 100644 --- a/htdocs/install/mysql/migration/19.0.0-20.0.0.sql +++ b/htdocs/install/mysql/migration/19.0.0-20.0.0.sql @@ -212,6 +212,10 @@ ALTER TABLE llx_knowledgemanagement_knowledgerecord MODIFY COLUMN answer longtex -- Rename const to add customer categories on not customer/prospect third-party if enabled UPDATE llx_const SET name = 'THIRDPARTY_CAN_HAVE_CUSTOMER_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT' WHERE name = 'THIRDPARTY_CAN_HAVE_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT_SUPPLIER'; +ALTER TABLE llx_fichinter ADD COLUMN signed integer DEFAULT NULL AFTER duree; + +ALTER TABLE llx_mailing ADD COLUMN messtype varchar(16) DEFAULT 'email' after rowid; + ALTER TABLE llx_ticket ADD COLUMN model_pdf varchar(255); ALTER TABLE llx_ticket ADD COLUMN last_main_doc varchar(255); ALTER TABLE llx_ticket ADD COLUMN extraparams varchar(255); diff --git a/htdocs/install/mysql/tables/llx_fichinter.sql b/htdocs/install/mysql/tables/llx_fichinter.sql index b9f9008f202..9e5d932b21a 100644 --- a/htdocs/install/mysql/tables/llx_fichinter.sql +++ b/htdocs/install/mysql/tables/llx_fichinter.sql @@ -39,6 +39,7 @@ create table llx_fichinter datee date, -- date de fin d'intervention datet date, -- date de terminaison de l'intervention duree real, -- duree totale de l'intervention + signed integer DEFAULT NULL, -- signed status description text, note_private text, note_public text, diff --git a/htdocs/install/mysql/tables/llx_mailing-mailing.sql b/htdocs/install/mysql/tables/llx_mailing-mailing.sql index 809054cc879..eb03b17853b 100644 --- a/htdocs/install/mysql/tables/llx_mailing-mailing.sql +++ b/htdocs/install/mysql/tables/llx_mailing-mailing.sql @@ -18,15 +18,10 @@ -- ======================================================================== --- draft : 0 --- valid : 1 --- approved : 2 --- sent : 3 - create table llx_mailing ( rowid integer AUTO_INCREMENT PRIMARY KEY, - statut smallint DEFAULT 0, -- + messtype varchar(16) DEFAULT 'email', -- 'email' or 'sms' or ... titre varchar(128), -- Ref of mailing entity integer DEFAULT 1 NOT NULL, -- multi company id sujet varchar(128), -- Sujet of mailing @@ -34,9 +29,9 @@ create table llx_mailing bgcolor varchar(8), -- Backgroud color of mailing bgimage varchar(255), -- Backgroud image of mailing evenunsubscribe smallint DEFAULT 0, -- If 1, email will be send event if recipient has opt-out to emailings - cible varchar(60), + cible varchar(60), -- ??? nbemail integer, - email_from varchar(160), -- Email address of sender + email_from varchar(160), -- Email address or Phone of sender name_from varchar(128), -- Name to show of sender email_replyto varchar(160), -- Email address for reply email_errorsto varchar(160), -- Email addresse for errors @@ -50,11 +45,12 @@ create table llx_mailing fk_user_modif integer, -- user of last modification fk_user_valid integer, -- user validator fk_user_appro integer, -- not used - extraparams varchar(255), -- for stock other parameters with json format + extraparams varchar(255), -- to stock other parameters with json format joined_file1 varchar(255), joined_file2 varchar(255), joined_file3 varchar(255), joined_file4 varchar(255), + statut smallint DEFAULT 0, -- status (draft:0, valid: 1, approved: 2, sent: 3) note_private text, note_public text )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_product.sql b/htdocs/install/mysql/tables/llx_product.sql index 0dd84d550f5..ad7160f2dab 100644 --- a/htdocs/install/mysql/tables/llx_product.sql +++ b/htdocs/install/mysql/tables/llx_product.sql @@ -108,7 +108,7 @@ create table llx_product price_autogen tinyint DEFAULT 0, fk_project integer DEFAULT NULL, -- Used when product was generated by a project or is specific to a project mandatory_period tinyint DEFAULT 0, -- is used to signal to the user that the start and end dates are mandatory for this type of product the fk_product_type == 1 (service) (non-blocking action) - + last_main_doc varchar(255), fk_default_bom integer DEFAULT NULL, fk_default_workstation integer DEFAULT NULL )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_societe.sql b/htdocs/install/mysql/tables/llx_societe.sql index 639874b6231..111f4d8753c 100644 --- a/htdocs/install/mysql/tables/llx_societe.sql +++ b/htdocs/install/mysql/tables/llx_societe.sql @@ -43,13 +43,13 @@ create table llx_societe address varchar(255), -- company address zip varchar(25), -- zipcode town varchar(50), -- town - fk_departement integer DEFAULT 0, -- - fk_pays integer DEFAULT 0, -- + fk_departement integer DEFAULT 0, -- state + fk_pays integer DEFAULT 0, -- country fk_account integer DEFAULT 0, -- default bank account phone varchar(20), -- phone number fax varchar(20), -- fax number - url varchar(255), -- - email varchar(128), -- + url varchar(255), -- web site + email varchar(128), -- main email socialnetworks text DEFAULT NULL, -- json with socialnetworks diff --git a/htdocs/install/mysql/tables/llx_ticket-ticket.sql b/htdocs/install/mysql/tables/llx_ticket-ticket.sql index 4006046449d..c249f6780b3 100644 --- a/htdocs/install/mysql/tables/llx_ticket-ticket.sql +++ b/htdocs/install/mysql/tables/llx_ticket-ticket.sql @@ -49,5 +49,8 @@ CREATE TABLE llx_ticket last_main_doc varchar(255), -- relative filepath+filename of last main generated document extraparams varchar(255), -- to save other parameters with json format tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + model_pdf varchar(255), + last_main_doc varchar(255), -- relative filepath+filename of last main generated document + extraparams varchar(255), -- to save other parameters with json format import_key varchar(14) )ENGINE=innodb; diff --git a/htdocs/intracommreport/card.php b/htdocs/intracommreport/card.php index c234f22c7e4..358385af8f7 100644 --- a/htdocs/intracommreport/card.php +++ b/htdocs/intracommreport/card.php @@ -78,9 +78,9 @@ $hookmanager->initHooks(array('intracommcard', 'globalcard')); $error = 0; // Permissions -$permissiontoread = $user->rights->intracommreport->read; -$permissiontoadd = $user->rights->intracommreport->write; -$permissiontodelete = $user->rights->intracommreport->delete; +$permissiontoread = $user->hasRight('intracommreport', 'read'); +$permissiontoadd = $user->hasRight('intracommreport', 'write'); +$permissiontodelete = $user->hasRight('intracommreport', 'delete'); // Security check (enable the most restrictive one) //if ($user->socid > 0) accessforbidden(); diff --git a/htdocs/intracommreport/list.php b/htdocs/intracommreport/list.php index ecf2ed66019..a3947ba03bc 100644 --- a/htdocs/intracommreport/list.php +++ b/htdocs/intracommreport/list.php @@ -153,8 +153,8 @@ if ($search_type == '0') { $result = restrictedArea($user, 'produit|service', '', '', '', '', '', 0); } -$permissiontoread = $user->rights->intracommreport->read; -$permissiontodelete = $user->rights->intracommreport->delete; +$permissiontoread = $user->hasRight('intracommreport', 'read'); +$permissiontodelete = $user->hasRight('intracommreport', 'delete'); /* diff --git a/htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php b/htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php index ceae56fd3fd..6f12ceadf7d 100644 --- a/htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php +++ b/htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php @@ -101,7 +101,7 @@ class KnowledgeManagement extends DolibarrApi */ public function getCategories($id, $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0) { - if (!DolibarrApiAccess::$user->rights->categorie->lire) { + if (!DolibarrApiAccess::$user->hasRight('categorie', 'lire')) { throw new RestException(403); } @@ -149,7 +149,7 @@ class KnowledgeManagement extends DolibarrApi // If the internal user must only see his customers, force searching by him $search_sale = 0; - if ($restrictonsocid && !DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) { + if ($restrictonsocid && !DolibarrApiAccess::$user->hasRight('societe', 'client', 'voir') && !$socid) { $search_sale = DolibarrApiAccess::$user->id; } diff --git a/htdocs/knowledgemanagement/core/modules/knowledgemanagement/mod_knowledgerecord_advanced.php b/htdocs/knowledgemanagement/core/modules/knowledgemanagement/mod_knowledgerecord_advanced.php index fc22678a87a..0c1b043f006 100644 --- a/htdocs/knowledgemanagement/core/modules/knowledgemanagement/mod_knowledgerecord_advanced.php +++ b/htdocs/knowledgemanagement/core/modules/knowledgemanagement/mod_knowledgerecord_advanced.php @@ -123,7 +123,7 @@ class mod_knowledgerecord_advanced extends ModeleNumRefKnowledgeRecord * Return next free value * * @param Object $object Object we need next value for - * @return string Value if KO, <0 if KO + * @return string|0 Next value if OK, 0 if KO */ public function getNextValue($object) { diff --git a/htdocs/knowledgemanagement/core/modules/knowledgemanagement/mod_knowledgerecord_standard.php b/htdocs/knowledgemanagement/core/modules/knowledgemanagement/mod_knowledgerecord_standard.php index 20ba2817501..3d509d7d25c 100644 --- a/htdocs/knowledgemanagement/core/modules/knowledgemanagement/mod_knowledgerecord_standard.php +++ b/htdocs/knowledgemanagement/core/modules/knowledgemanagement/mod_knowledgerecord_standard.php @@ -117,7 +117,7 @@ class mod_knowledgerecord_standard extends ModeleNumRefKnowledgeRecord * Return next free value * * @param Object $object Object we need next value for - * @return string Value if KO, <0 if KO + * @return string|-1 Next value if OK, -1 if KO */ public function getNextValue($object) { diff --git a/htdocs/knowledgemanagement/knowledgerecord_document.php b/htdocs/knowledgemanagement/knowledgerecord_document.php index f83bcd883e0..75780701b36 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_document.php +++ b/htdocs/knowledgemanagement/knowledgerecord_document.php @@ -183,10 +183,6 @@ if ($object->id) { print dol_get_fiche_end(); $modulepart = 'knowledgemanagement'; - //$permission = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'write'); - $permission = 1; - //$permtoedit = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'write'); - $permtoedit = 1; $param = '&id='.$object->id; //$relativepathwithnofile='knowledgerecord/' . dol_sanitizeFileName($object->id).'/'; diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 068dc7eab7e..efe0ffc9246 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -149,7 +149,6 @@ MaxNbOfLinesForBoxes=Max. number of lines for widgets AllWidgetsWereEnabled=All available widgets are enabled WidgetAvailable=Widget available PositionByDefault=Default order -Position=Position MenusDesc=Menu managers set content of the two menu bars (horizontal and vertical). MenusEditorDesc=The menu editor allows you to define custom menu entries. Use it carefully to avoid instability and permanently unreachable menu entries.
Some modules add menu entries (in menu All mostly). If you remove some of these entries by mistake, you can restore them disabling and reenabling the module. MenuForUsers=Menu for users @@ -220,7 +219,6 @@ ModulesMarketPlaces=Find external app/modules ModulesDevelopYourModule=Develop your own app/modules ModulesDevelopDesc=You may also develop your own module or find a partner to develop one for you. DOLISTOREdescriptionLong=Instead of switching on www.dolistore.com web site to find an external module, you can use this embedded tool that will perform the search on the external market place for you (may be slow, need an internet access)... -NewModule=New module FreeModule=Free CompatibleUpTo=Compatible with version %s NotCompatible=This module does not seem compatible with your Dolibarr %s (Min %s - Max %s). @@ -304,7 +302,7 @@ MAIN_DISABLE_ALL_MAILS=Disable all email sending (for test purposes or demos) MAIN_MAIL_FORCE_SENDTO=Send all emails to (instead of real recipients, for test purposes) MAIN_MAIL_ENABLED_USER_DEST_SELECT=Suggest emails of employees (if defined) into the list of predefined recipient when writing a new email MAIN_MAIL_NO_WITH_TO_SELECTED=Do not select a default recipient even if there is only 1 possible choice -MAIN_MAIL_SENDMODE=Email sending method +MAIN_MAIL_SENDMODE=Sending method MAIN_MAIL_SMTPS_ID=SMTP ID (if sending server requires authentication) MAIN_MAIL_SMTPS_PW=SMTP Password (if sending server requires authentication) MAIN_MAIL_EMAIL_TLS=Use TLS (SSL) encryption @@ -435,6 +433,7 @@ MassConvert=Launch bulk conversion PriceFormatInCurrentLanguage=Price Format In Current Language String=String String1Line=String (1 line) +Text=Text TextLong=Long text TextLongNLines=Long text (n lines) HtmlText=Html text @@ -1209,7 +1208,6 @@ EnableMultilangInterface=Enable multilanguage support for customer or vendor rel EnableShowLogo=Show the company logo in the menu CompanyInfo=Company/Organization CompanyIds=Company/Organization identities -CompanyName=Name CompanyAddress=Address CompanyZip=Zip CompanyTown=Town @@ -1748,8 +1746,6 @@ BarcodeDescQRCODE=Barcode of type QR code GenbarcodeLocation=Bar code generation command line tool (used by internal engine for some bar code types). Must be compatible with "genbarcode".
For example: /usr/local/bin/genbarcode BarcodeInternalEngine=Internal engine BarCodeNumberManager=Manager to auto define barcode numbers -##### Prelevements ##### -WithdrawalsSetup=Setup of module Direct Debit payments ##### ExternalRSS ##### ExternalRSSSetup=External RSS imports setup NewRSS=New RSS Feed @@ -2333,7 +2329,6 @@ ExportUseLowMemoryModeHelp=Use the low memory mode to generate the dump file (co ModuleWebhookName = Webhook ModuleWebhookDesc = Interface to catch dolibarr triggers and send data of the event to an URL WebhookSetup = Webhook setup -Settings = Settings WebhookSetupPage = Webhook setup page ShowQuickAddLink=Show a button to quickly add an element in top right menu ShowSearchAreaInTopMenu=Show the search area in the top menu diff --git a/htdocs/langs/en_US/agenda.lang b/htdocs/langs/en_US/agenda.lang index e0faafd5984..70ce8809858 100644 --- a/htdocs/langs/en_US/agenda.lang +++ b/htdocs/langs/en_US/agenda.lang @@ -8,8 +8,6 @@ LocalAgenda=Default calendar ActionsOwnedBy=Event owned by ActionsOwnedByShort=Owner AffectedTo=Assigned to -Event=Event -Events=Events EventsNb=Number of events ListOfActions=List of events EventReports=Event reports @@ -190,10 +188,8 @@ MenuBookcalIndex=Online appointment BookcalLabelAvailabilityHelp=Label of the availability range. For example:
General availability
Availability during christmas holidays DurationOfRange=Duration of ranges BookCalSetup = Online appointment setup -Settings = Settings BookCalSetupPage = Online appointment setup page BOOKCAL_PUBLIC_INTERFACE_TOPIC = Interface title -About = About BookCalAbout = About BookCal BookCalAboutPage = BookCal about page Calendars=Calendars diff --git a/htdocs/langs/en_US/banks.lang b/htdocs/langs/en_US/banks.lang index c6970765e9c..a7ff18831ab 100644 --- a/htdocs/langs/en_US/banks.lang +++ b/htdocs/langs/en_US/banks.lang @@ -67,7 +67,6 @@ AccountsArea=Accounts area AccountCard=Account card DeleteAccount=Delete account ConfirmDeleteAccount=Are you sure you want to delete this account? -Account=Account BankTransactionByCategories=Bank entries by categories BankTransactionForCategory=Bank entries for category %s RemoveFromRubrique=Remove link with category diff --git a/htdocs/langs/en_US/blockedlog.lang b/htdocs/langs/en_US/blockedlog.lang index cb66945f888..06ccc6b6b37 100644 --- a/htdocs/langs/en_US/blockedlog.lang +++ b/htdocs/langs/en_US/blockedlog.lang @@ -1,5 +1,4 @@ BlockedLog=Unalterable Logs -Field=Field BlockedLogDesc=This module tracks some events into an unalterable log (that you can't modify once recorded) into a block chain, in real time. This module provides compatibility with requirements of laws of some countries (like France with the law Finance 2016 - Norme NF525). Fingerprints=Archived events and fingerprints FingerprintsDesc=This is the tool to browse or extract the unalterable logs. Unalterable logs are generated and archived locally into a dedicated table, in real time when you record a business event. You can use this tool to export this archive and save it into an external support (some countries, like France, ask that you do it every year). Note that, there is no feature to purge this log and every change tried to be done directly into this log (by a hacker for example) will be reported with a non-valid fingerprint. If you really need to purge this table because you used your application for a demo/test purpose and want to clean your data to start your production, you can ask your reseller or integrator to reset your database (all your data will be removed). @@ -13,7 +12,6 @@ OkCheckFingerprintValidity=Archived log record is valid. The data on this line w OkCheckFingerprintValidityButChainIsKo=Archived log seems valid compared to previous one but the chain was corrupted previously. AddedByAuthority=Stored into remote authority NotAddedByAuthorityYet=Not yet stored into remote authority -ShowDetails=Show stored details BlockedLogBillDownload=Customer invoice download BlockedLogBillPreview=Customer invoice preview BlockedlogInfoDialog=Log Details diff --git a/htdocs/langs/en_US/cashdesk.lang b/htdocs/langs/en_US/cashdesk.lang index dba0ab25634..49053c063e7 100644 --- a/htdocs/langs/en_US/cashdesk.lang +++ b/htdocs/langs/en_US/cashdesk.lang @@ -90,7 +90,6 @@ ColorTheme=Color theme Colorful=Colorful HeadBar=Head Bar SortProductField=Field for sorting products -Browser=Browser BrowserMethodDescription=Simple and easy receipt printing. Only a few parameters to configure the receipt. Print via browser. TakeposConnectorMethodDescription=External module with extra features. Possibility to print from the cloud. PrintMethod=Print method diff --git a/htdocs/langs/en_US/categories.lang b/htdocs/langs/en_US/categories.lang index 5471c4afad0..8a4d3783d64 100644 --- a/htdocs/langs/en_US/categories.lang +++ b/htdocs/langs/en_US/categories.lang @@ -103,4 +103,3 @@ WebsitePagesCategoriesArea=Page-Container Categories KnowledgemanagementsCategoriesArea=KM article Categories UseOrOperatorForCategories=Use 'OR' operator for categories AddObjectIntoCategory=Assign to the category -Position=Position diff --git a/htdocs/langs/en_US/cron.lang b/htdocs/langs/en_US/cron.lang index 52de5a48b82..b40a7df0318 100644 --- a/htdocs/langs/en_US/cron.lang +++ b/htdocs/langs/en_US/cron.lang @@ -1,6 +1,5 @@ # Dolibarr language file - Source file is en_US - cron -# About page -# Right +# Permissions Permission23101 = Read Scheduled job Permission23102 = Create/update Scheduled job Permission23103 = Delete Scheduled job diff --git a/htdocs/langs/en_US/datapolicy.lang b/htdocs/langs/en_US/datapolicy.lang index 6b4413f812b..4f3f3682ab1 100644 --- a/htdocs/langs/en_US/datapolicy.lang +++ b/htdocs/langs/en_US/datapolicy.lang @@ -23,7 +23,7 @@ Module4100Desc = Module to manage Data Privacy (Conformity with the GDPR) # datapolicySetup = Module Data Privacy Policy Setup Deletion = Deletion of data -datapolicySetupPage = Depending of laws of your countries (Example Article 5 of the GDPR), personal data must be kept for a period not exceeding that necessary for the purposes for which they were collected, except for archival purposes.
The deletion will be done automatically after a certain duration without event (the duration which you will have indicated below). +datapolicySetupPage = Depending on the laws of your countries (Example Article 5 of the GDPR), personal data must be kept for a period not exceeding the duration the data is needed for the purpose for which it was collected, except for archival purposes.
The deletion will be done automatically after a certain duration without events (the duration which you will have indicated below). NB_MONTHS = %s months ONE_YEAR = 1 year NB_YEARS = %s years @@ -40,25 +40,25 @@ DATAPOLICY_CONTACT_FOURNISSEUR = Supplier DATAPOLICY_ADHERENT = Member DATAPOLICY_Tooltip_SETUP = Type of contact - Indicate your choices for each type. DATAPOLICYMail = Emails Setup -DATAPOLICYSUBJECTMAIL = Subject of email +DATAPOLICYSUBJECTMAIL = Subject of the email DATAPOLICYCONTENTMAIL = Content of the email DATAPOLICYSUBSITUTION = You can use the following variables in your email (LINKACCEPT allows to create a link recording the agreement of the person, LINKREFUSED makes it possible to record the refusal of the person): DATAPOLICYACCEPT = Message after agreement -DATAPOLICYREFUSE = Message after desagreement +DATAPOLICYREFUSE = Message after disagreement SendAgreementText = You can send a GDPR email to all your relevant contacts (who have not yet received an email and for which you have not registered anything about their GDPR agreement). To do this, use the following button. SendAgreement = Send emails AllAgreementSend = All emails have been sent -TXTLINKDATAPOLICYACCEPT = Text for the link "agreement" -TXTLINKDATAPOLICYREFUSE = Text for the link "desagreement" +TXTLINKDATAPOLICYACCEPT = Text for the link "agreement" +TXTLINKDATAPOLICYREFUSE = Text for the link "disagreement" # # Extrafields # DATAPOLICY_BLOCKCHECKBOX = GDPR : Processing of personal data -DATAPOLICY_consentement = Consent obtained for the processing of personal data -DATAPOLICY_opposition_traitement = Opposes the processing of his personal data -DATAPOLICY_opposition_prospection = Opposes the processing of his personal data for the purposes of prospecting +DATAPOLICY_consentement = Consent obtained for the processing of personal data +DATAPOLICY_opposition_traitement = Opposes to the processing of his personal data +DATAPOLICY_opposition_prospection = Opposes to the processing of his personal data for the purposes of prospecting # # Popup @@ -68,7 +68,7 @@ DATAPOLICY_POPUP_ANONYME_TEXTE = You can not delete this contact from Dolibarr b # # Button for portability -# +# DATAPOLICY_PORTABILITE = Portability GDPR DATAPOLICY_PORTABILITE_TITLE = Export of personal data DATAPOLICY_PORTABILITE_CONFIRMATION = You want to export the personal data of this contact. Are you sure ? @@ -78,12 +78,11 @@ DATAPOLICY_PORTABILITE_CONFIRMATION = You want to export the personal data of th # ANONYMISER_AT = Anonymised the %s -DATAPOLICY_date = Date of agreement/desagreement GDPR -DATAPOLICY_send = Date sending agreement email +DATAPOLICY_date = Date of agreement/disagreement GDPR +DATAPOLICY_send = Date agreement email sent DATAPOLICY_SEND = Send GDPR email MailSent = Email has been sent # ERROR -ErrorSubjectIsRequired = Error : The subject of email is required. Indicate it in the module setup -=Due to a technical problem, we were unable to register your choice. We apologize for that. Contact us to send us your choice. -NUMBER_MONTH_BEFORE_DELETION = Number of month before deletion +=Due to a technical problem, we were unable to register your choice. We apologize for that. Contact us to notify us your choice. +NUMBER_MONTH_BEFORE_DELETION = Number of months before deletion diff --git a/htdocs/langs/en_US/donations.lang b/htdocs/langs/en_US/donations.lang index 2f97f9ae818..e60a65efb46 100644 --- a/htdocs/langs/en_US/donations.lang +++ b/htdocs/langs/en_US/donations.lang @@ -31,6 +31,7 @@ DONATION_ART200=Show article 200 from CGI if you are concerned DONATION_ART238=Show article 238 from CGI if you are concerned DONATION_ART978=Show article 978 from CGI if you are concerned DonationPayment=Donation payment +DonationPayments=Donation payments DonationValidated=Donation %s validated DonationUseThirdparties=Use the address of an existing thirdparty as the address of the donor DonationsStatistics=Donation's statistics diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index d3ec7e33148..71b2dccb2bf 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -325,6 +325,7 @@ ErrorSVGFilesNotAllowedAsLinksWithout=SVG files are not allowed as external link ErrorTypeMenu=Impossible to add another menu for the same module on the navbar, not handle yet ErrorObjectNotFound = The object %s is not found, please check your url ErrorCountryCodeMustBe2Char=Country code must be a 2 character string +ErrorABatchShouldNotContainsSpaces=A lot or serial number should not contains spaces ErrorTableExist=Table %s already exist ErrorDictionaryNotFound=Dictionary %s not found @@ -406,5 +407,7 @@ ErrorTooManyAttempts= Too many attempts, please try again later TotalAmountEmpty=Total Amount Empty FailedToFoundTheConversionRateForInvoice=Failed to found the conversion rate for invoice -ThisIdNotDefined=$this->id not defined -OperNotDefined=Oper not defined +ThisIdNotDefined=Id not defined +OperNotDefined=Payment method not defined +ErrorThisContactXIsAlreadyDefinedAsThisType=%s is already defined as contact for this type. +ErrorThisGroupIsAlreadyDefinedAsThisType=The contacts with this group are already defined as contact for this type. diff --git a/htdocs/langs/en_US/eventorganization.lang b/htdocs/langs/en_US/eventorganization.lang index 30c3f5d6b59..8cfd9f6f981 100644 --- a/htdocs/langs/en_US/eventorganization.lang +++ b/htdocs/langs/en_US/eventorganization.lang @@ -34,7 +34,6 @@ PaymentEvent=Payment of event NewRegistration=Registration EventOrganizationSetup=Event Organization setup EventOrganization=Event organization -Settings=Settings EventOrganizationSetupPage = Event Organization setup page EVENTORGANIZATION_TASK_LABEL = Label of tasks to create automatically when project is validated EVENTORGANIZATION_TASK_LABELTooltip = When you validate an event to organize, some tasks can be automatically created in the project

For example:
Send Call for Conferences
Send Call for Booths
Validate suggestions of Conferences
Validate application for Booths
Open subscriptions to the event for attendees
Send a remind of the event to speakers
Send a remind of the event to Booth hosters
Send a remind of the event to attendees diff --git a/htdocs/langs/en_US/exports.lang b/htdocs/langs/en_US/exports.lang index 94ca852beca..29311b3b466 100644 --- a/htdocs/langs/en_US/exports.lang +++ b/htdocs/langs/en_US/exports.lang @@ -62,7 +62,6 @@ ChooseFileToImport=Upload file then click on the %s icon to select file as sourc SourceFileFormat=Source file format FieldsInSourceFile=Fields in source file FieldsInTargetDatabase=Target fields in Dolibarr database (bold=mandatory) -Field=Field NoFields=No fields MoveField=Move field column number %s ExampleOfImportFile=Example_of_import_file diff --git a/htdocs/langs/en_US/knowledgemanagement.lang b/htdocs/langs/en_US/knowledgemanagement.lang index acf1bd62f11..e0d1fabecfc 100644 --- a/htdocs/langs/en_US/knowledgemanagement.lang +++ b/htdocs/langs/en_US/knowledgemanagement.lang @@ -26,14 +26,12 @@ ModuleKnowledgeManagementDesc=Manage a Knowledge Management (KM) or Help-Desk ba # Admin page # KnowledgeManagementSetup = Knowledge Management System setup -Settings = Settings KnowledgeManagementSetupPage = Knowledge Management System setup page # # About page # -About = About KnowledgeManagementAbout = About Knowledge Management KnowledgeManagementAboutPage = Knowledge Management about page diff --git a/htdocs/langs/en_US/mails.lang b/htdocs/langs/en_US/mails.lang index 38901ccf3a3..704b4553dcc 100644 --- a/htdocs/langs/en_US/mails.lang +++ b/htdocs/langs/en_US/mails.lang @@ -9,6 +9,7 @@ MailRecipients=Recipients MailRecipient=Recipient MailTitle=Description MailFrom=From +PhoneFrom=From MailErrorsTo=Errors to MailReply=Reply to MailTo=To @@ -32,7 +33,7 @@ DeleteMailing=Delete emailing DeleteAMailing=Delete an emailing PreviewMailing=Preview emailing CreateMailing=Create emailing -TestMailing=Test email +TestMailing=Test ValidMailing=Valid emailing MailingStatusDraft=Draft MailingStatusValidated=Validated @@ -52,6 +53,7 @@ ConfirmValidMailing=Are you sure you want to validate this emailing? ConfirmResetMailing=Warning, by re-initializing emailing %s, you will allow the re-sending this email in a bulk mailing. Are you sure you want to do this? ConfirmDeleteMailing=Are you sure you want to delete this emailing? NbOfUniqueEMails=No. of unique emails +NbOfUniquePhones=No. of unique phones NbOfEMails=No. of EMails TotalNbOfDistinctRecipients=Number of distinct recipients NoTargetYet=No recipients defined yet (Go on tab 'Recipients') @@ -187,6 +189,6 @@ EvenUnsubscribe=Include opt-out emails EvenUnsubscribeDesc=Include opt-out emails when you select emails as targets. Useful for mandatory service emails for example. XEmailsDoneYActionsDone=%s emails pre-qualified, %s emails successfully processed (for %s record/actions done) helpWithAi=Generate message from AI -YouCanMakeSomeInstructionForEmail=You Can Make Some Instruction For your Email (Exemple: generate image in email template...) +YouCanMakeSomeInstructionForEmail=You can make some instructions for your Email (Example: generate image in email template...) ModelTemplate=Email template -YouCanChooseAModelForYouMailContent= You can shoose one of models or generate one with Ai \ No newline at end of file +YouCanChooseAModelForYouMailContent= You can choose one of template models or generate one with AI diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index f7a4127ac5e..e94b0281eb3 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -963,6 +963,7 @@ AutomaticallyCalculated=Automatically calculated TitleSetToDraft=Go back to draft ConfirmSetToDraft=Are you sure you want to go back to Draft status? ImportId=Import id +Event=Event Events=Events EMailTemplates=Email templates FileNotShared=File not shared to external public @@ -1180,7 +1181,6 @@ ConfirmAffectUserQuestion=Are you sure you want to assign users to the %s select 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 -Rate=Rate SupervisorNotFound=Supervisor not found CopiedToClipboard=Copied to clipboard InformationOnLinkToContract=This amount is only the total of all the lines of the contract. No notion of time is taken into consideration. @@ -1213,6 +1213,7 @@ CanceledHidden=Canceled hidden CanceledShown=Canceled shown Terminate=Terminate Terminated=Terminated +Position=Position 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)? @@ -1263,3 +1264,4 @@ ConfirmMassReverseQuestion=Are you sure you want to reverse the %s selected reco ElementType=Element type ElementId=Element Id Encrypted=Encrypted +Settings=Settings diff --git a/htdocs/langs/en_US/members.lang b/htdocs/langs/en_US/members.lang index 34148bf11e2..05946edce75 100644 --- a/htdocs/langs/en_US/members.lang +++ b/htdocs/langs/en_US/members.lang @@ -124,10 +124,6 @@ ExportDataset_member_1=Members and contributions ImportDataset_member_1=Members LastMembersModified=Latest %s modified members LastSubscriptionsModified=Latest %s modified contributions -String=String -Text=Text -Int=Int -DateAndTime=Date and time PublicMemberCard=Public member card SubscriptionNotRecorded=Contribution not recorded AddSubscription=Create contribution @@ -243,4 +239,10 @@ MemberLastname=Member lastname MemberCodeDesc=Member Code, unique for all members MemberSubscriptionStartFirstDayOf=The start date of a membership corresponds to the first day of a MemberSubscriptionStartAfter=Minimum period before the entry into force of the start date of a subscription except renewals (example +3m = +3 months, -5d = -5 days, +1Y = +1 year) -SubscriptionLinkedToConciliatedTransaction=Membership is linked to a conciliated transaction so this modification is not allowed. \ No newline at end of file +SubscriptionLinkedToConciliatedTransaction=Membership is linked to a conciliated transaction so this modification is not allowed. +ConfirmMassSubsriptionCreation=Confirm subscription creation +ConfirmMassSubsriptionCreationQuestion=Are you sure you want to create the %s selected subscription(s)? +XSubsriptionCreated=%s subscription(s) created +XSubsriptionErrors=%s subscription(s) where in error +CreateSubscription=Create subscription +WarningNoComplementaryActionDone=No Complementary action on recording will be executed with this massaction \ No newline at end of file diff --git a/htdocs/langs/en_US/multicurrency.lang b/htdocs/langs/en_US/multicurrency.lang index 866a83a32ed..e73eae58d42 100644 --- a/htdocs/langs/en_US/multicurrency.lang +++ b/htdocs/langs/en_US/multicurrency.lang @@ -16,7 +16,6 @@ CurrenciesUsed_help_to_add=Add the different currencies and rates you need to us rate=rate MulticurrencyReceived=Received, original currency MulticurrencyRemainderToTake=Remaining amount, original currency -MulticurrencyPaymentAmount=Payment amount, original currency AmountToOthercurrency=Amount To (in currency of receiving account) CurrencyRateSyncSucceed=Currency rate synchronization done successfully MULTICURRENCY_USE_CURRENCY_ON_DOCUMENT=Use the currency of the document for online payments diff --git a/htdocs/langs/en_US/orders.lang b/htdocs/langs/en_US/orders.lang index 662348b6977..acee379edad 100644 --- a/htdocs/langs/en_US/orders.lang +++ b/htdocs/langs/en_US/orders.lang @@ -130,7 +130,7 @@ DispatchSupplierOrder=Receiving purchase order %s FirstApprovalAlreadyDone=First approval already done SecondApprovalAlreadyDone=Second approval already done SupplierOrderReceivedInDolibarr=Purchase Order %s received %s -SupplierOrderSubmitedInDolibarr=Purchase Order %s submitted +SupplierOrderSubmitedInDolibarr=Purchase Order %s submitted (%s) SupplierOrderClassifiedBilled=Purchase Order %s set billed OtherOrders=Other orders SupplierOrderValidatedAndApproved=Supplier order is validated and approved : %s diff --git a/htdocs/langs/en_US/recruitment.lang b/htdocs/langs/en_US/recruitment.lang index 50085bd578f..fcbf87e49f4 100644 --- a/htdocs/langs/en_US/recruitment.lang +++ b/htdocs/langs/en_US/recruitment.lang @@ -26,7 +26,6 @@ ModuleRecruitmentDesc = Manage and follow recruitment campaigns for new job posi # Admin page # RecruitmentSetup = Recruitment setup -Settings = Settings RecruitmentSetupPage = Enter here the setup of main options for the recruitment module RecruitmentArea=Recruitement area PublicInterfaceRecruitmentDesc=Public pages of jobs are public URLs to show and answer to open jobs. There is one different link for each open job, found on each job record. @@ -35,7 +34,6 @@ EnablePublicRecruitmentPages=Enable public pages of open jobs # # About page # -About = About RecruitmentAbout = About Recruitment RecruitmentAboutPage = Recruitment about page NbOfEmployeesExpected=Expected nb of employees diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index 929374d21f0..70a25ea5e27 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -314,7 +314,6 @@ StockStransferIncrementedShort=Stocks transferred StockStransferIncrementedShortCancel=Increase of destination warehouses canceled StockTransferNoBatchForProduct=Product %s doesn't use batch, clear batch on line and retry StockTransferSetup = Stocks Transfer module configuration -Settings=Settings StockTransferSetupPage = Configuration page for stocks transfer module StockTransferRightRead=Read stocks transfers StockTransferRightCreateUpdate=Create/Update stocks transfers diff --git a/htdocs/langs/en_US/suppliers.lang b/htdocs/langs/en_US/suppliers.lang index 08895194016..770a143c231 100644 --- a/htdocs/langs/en_US/suppliers.lang +++ b/htdocs/langs/en_US/suppliers.lang @@ -8,7 +8,6 @@ NewSupplierInvoice = New vendor invoice History=History ListOfSuppliers=List of vendors ShowSupplier=Show vendor -OrderDate=Order date BuyingPriceMin=Best buying price BuyingPriceMinShort=Best buying price TotalBuyingPriceMinShort=Total of subproducts buying prices diff --git a/htdocs/langs/en_US/website.lang b/htdocs/langs/en_US/website.lang index 779e63b23d2..45cb1781e5c 100644 --- a/htdocs/langs/en_US/website.lang +++ b/htdocs/langs/en_US/website.lang @@ -157,7 +157,6 @@ Booking=Booking Reservation=Reservation PagesViewedPreviousMonth=Pages viewed (previous month) PagesViewedTotal=Pages viewed (total) -Visibility=Visibility Everyone=Everyone AssignedContacts=Assigned contacts WebsiteTypeLabel=Type of Web site @@ -170,7 +169,6 @@ ModuleWebPortalDesc=A ready to use native web portal for customers, suppliers, p WebPortalDescription=Public web portal module for membership and partnership WebPortalSetup=WebPortal setup WebPortalCSS=Web portal CSS -Settings=Settings WebPortalSetupPage=WebPortal setup page WEBPORTAL_TITLE=Brand name on header of public page UserAccountForWebPortalAreInThirdPartyTabHelp=Users accounts for WebPortal can be set on each third party card in Website accounts tab @@ -231,3 +229,9 @@ WebPortalErrorFetchLoggedThirdParty=Error when loading third-party (Id : %s) WebPortalErrorFetchLoggedMember=Error when loading member (Id : %s) WebPortalErrorFetchLoggedPartnership=Error when loading partnership (Third-party Id : %s, Member Id : %s) ExportIntoGIT=Export into sources +WebPortalMember=Membership +WebPortalOrder=Sale Order +WebPortalPartnership=Partnership +WebPortalPropal=Proposal +WebPortalGroupMenuAdmin=Administration +WebPortalGroupMenuTechnical=System \ No newline at end of file diff --git a/htdocs/langs/fr_FR/donations.lang b/htdocs/langs/fr_FR/donations.lang index 4cf3f4ca493..617877bcf73 100644 --- a/htdocs/langs/fr_FR/donations.lang +++ b/htdocs/langs/fr_FR/donations.lang @@ -33,8 +33,6 @@ DONATION_ART978=Afficher article 978 du CGI si vous êtes concernés DonationPayment=Paiement du don DonationValidated=Don %s validé -DonationsReglement= Règlements reçus pour les dons - DonationUseThirdparties=Utiliser un tiers existant comme coordonnées du donateur DonationsStatistics=Statistiques des dons diff --git a/htdocs/loan/card.php b/htdocs/loan/card.php index d29665eef9b..981d805e52b 100644 --- a/htdocs/loan/card.php +++ b/htdocs/loan/card.php @@ -291,11 +291,11 @@ if ($action == 'create') { // Bank account if (isModEnabled("banque")) { - print ''.$langs->trans("Account").''; + print ''.$langs->trans("BankAccount").''; $form->select_comptes(GETPOST("accountid"), "accountid", 0, "courant=1", 1); // Show list of bank account with courant print ''; } else { - print ''.$langs->trans("Account").''; + print ''.$langs->trans("BankAccount").''; print $langs->trans("NoBankAccountDefined"); print ''; } diff --git a/htdocs/loan/document.php b/htdocs/loan/document.php index 6aa24247afe..56bf59b10cc 100644 --- a/htdocs/loan/document.php +++ b/htdocs/loan/document.php @@ -72,7 +72,7 @@ if ($id > 0) { $upload_dir = $conf->loan->dir_output.'/'.dol_sanitizeFileName($object->ref); $modulepart = 'loan'; -$permissiontoadd = $user->rights->loan->write; // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles.inc.php +$permissiontoadd = $user->hasRight('loan', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles.inc.php /* @@ -164,8 +164,8 @@ if ($object->id) { print dol_get_fiche_end(); $modulepart = 'loan'; - $permissiontoadd = $user->rights->loan->write; - $permtoedit = $user->rights->loan->write; + $permissiontoadd = $user->hasRight('loan', 'write'); + $permtoedit = $user->hasRight('loan', 'write'); $param = '&id='.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } else { diff --git a/htdocs/loan/note.php b/htdocs/loan/note.php index 09a85f6aab0..ff5938a63c7 100644 --- a/htdocs/loan/note.php +++ b/htdocs/loan/note.php @@ -51,7 +51,7 @@ if ($id > 0) { $object->fetch($id); } -$permissionnote = $user->rights->loan->write; // Used by the include of actions_setnotes.inc.php +$permissionnote = $user->hasRight('loan', 'write'); // Used by the include of actions_setnotes.inc.php /* @@ -135,7 +135,7 @@ if ($id > 0) { print '
'; $cssclass = 'titlefield'; - $permission = $user->rights->loan->write; // Used by the include of notes.tpl.php + $permission = $user->hasRight('loan', 'write'); // Used by the include of notes.tpl.php include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; print dol_get_fiche_end(); diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index f531b40b56f..a677af39f57 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1790,7 +1790,7 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr // Displays title $appli = constant('DOL_APPLICATION_TITLE'); if (getDolGlobalString('MAIN_APPLICATION_TITLE')) { - $appli = $conf->global->MAIN_APPLICATION_TITLE; + $appli = getDolGlobalString('MAIN_APPLICATION_TITLE'); } print ''; @@ -1858,7 +1858,7 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr print '<!-- Includes CSS for JQuery (Ajax library) -->'."\n"; $jquerytheme = 'base'; if (getDolGlobalString('MAIN_USE_JQUERY_THEME')) { - $jquerytheme = $conf->global->MAIN_USE_JQUERY_THEME; + $jquerytheme = getDolGlobalString('MAIN_USE_JQUERY_THEME'); } if (constant('JS_JQUERY_UI')) { print '<link rel="stylesheet" type="text/css" href="'.JS_JQUERY_UI.'css/'.$jquerytheme.'/jquery-ui.min.css'.($ext ? '?'.$ext : '').'">'."\n"; // Forced JQuery @@ -2168,7 +2168,7 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead // Define link to login card $appli = constant('DOL_APPLICATION_TITLE'); if (getDolGlobalString('MAIN_APPLICATION_TITLE')) { - $appli = $conf->global->MAIN_APPLICATION_TITLE; + $appli = getDolGlobalString('MAIN_APPLICATION_TITLE'); if (preg_match('/\d\.\d/', $appli)) { if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) { $appli .= " (".DOL_VERSION.")"; // If new title contains a version that is different than core @@ -2525,7 +2525,7 @@ function top_menu_user($hideloginname = 0, $urllogout = '') // Define version to show $appli = constant('DOL_APPLICATION_TITLE'); if (getDolGlobalString('MAIN_APPLICATION_TITLE')) { - $appli = $conf->global->MAIN_APPLICATION_TITLE; + $appli = getDolGlobalString('MAIN_APPLICATION_TITLE'); if (preg_match('/\d\.\d/', $appli)) { if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) { $appli .= " (".DOL_VERSION.")"; // If new title contains a version that is different than core @@ -3170,7 +3170,7 @@ function left_menu($menu_array_before, $helppagename = '', $notused = '', $menu_ } $selected = -1; if (!getDolGlobalString('MAIN_USE_TOP_MENU_SEARCH_DROPDOWN')) { - // Select into select2 is awfull on smartphone. TODO Is this still true with select2 v4 ? + // Select with select2 is awful on smartphone. TODO Is this still true with select2 v4 ? if ($conf->browser->layout == 'phone') { $conf->global->MAIN_USE_OLD_SEARCH_FORM = 1; } @@ -3281,7 +3281,7 @@ function left_menu($menu_array_before, $helppagename = '', $notused = '', $menu_ $appli = constant('DOL_APPLICATION_TITLE'); if (getDolGlobalString('MAIN_APPLICATION_TITLE')) { - $appli = $conf->global->MAIN_APPLICATION_TITLE; $doliurl = ''; + $appli = getDolGlobalString('MAIN_APPLICATION_TITLE'); $doliurl = ''; if (preg_match('/\d\.\d/', $appli)) { if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) { $appli .= " (".DOL_VERSION.")"; // If new title contains a version that is different than core @@ -3347,7 +3347,7 @@ function left_menu($menu_array_before, $helppagename = '', $notused = '', $menu_ $bugbaseurl .= urlencode("\n"); $bugbaseurl .= urlencode("## Report\n"); } elseif (getDolGlobalString('MAIN_BUGTRACK_ENABLELINK')) { - $bugbaseurl = $conf->global->MAIN_BUGTRACK_ENABLELINK; + $bugbaseurl = getDolGlobalString('MAIN_BUGTRACK_ENABLELINK'); } else { $bugbaseurl = ""; } @@ -3415,7 +3415,7 @@ function main_area($title = '') print $hookmanager->resPrint; if (getDolGlobalString('MAIN_ONLY_LOGIN_ALLOWED')) { - print info_admin($langs->trans("WarningYouAreInMaintenanceMode", $conf->global->MAIN_ONLY_LOGIN_ALLOWED), 0, 0, 1, 'warning maintenancemode'); + print info_admin($langs->trans("WarningYouAreInMaintenanceMode", getDolGlobalString('MAIN_ONLY_LOGIN_ALLOWED')), 0, 0, 1, 'warning maintenancemode'); } // Permit to add user company information on each printed document by setting SHOW_SOCINFO_ON_PRINT diff --git a/htdocs/modulebuilder/template/README.md b/htdocs/modulebuilder/template/README.md index 30f081abd78..d6e49e154b7 100644 --- a/htdocs/modulebuilder/template/README.md +++ b/htdocs/modulebuilder/template/README.md @@ -1,4 +1,4 @@ -# MYMODULE FOR [DOLIBARR ERP CRM](https://www.dolibarr.org) +# MYMODULE FOR [DOLIBARR ERP & CRM](https://www.dolibarr.org) ## Features @@ -12,7 +12,7 @@ Other external modules are available on [Dolistore.com](https://www.dolistore.co ## Translations -Translations can be completed manually by editing files into directories *langs*. +Translations can be completed manually by editing files in the module directories under `langs`. <!-- This module contains also a sample configuration for Transifex, under the hidden directory [.tx](.tx), so it is possible to manage translation using this service. @@ -25,27 +25,27 @@ There is a [Transifex project](https://transifex.com/projects/p/dolibarr-module- ## Installation -Prerequisites: You must have the Dolibarr ERP CRM software installed. You can down it from [Dolistore.org](https://www.dolibarr.org). -You can also get a ready to use instance in the cloud from htts://saas.dolibarr.org +Prerequisites: You must have Dolibarr ERP & CRM software installed. You can download it from [Dolistore.org](https://www.dolibarr.org). +You can also get a ready-to-use instance in the cloud from https://saas.dolibarr.org ### From the ZIP file and GUI interface -If the module is a ready to deploy zip file, so with a name module_xxx-version.zip (like when downloading it from a market place like [Dolistore](https://www.dolistore.com)), -go into menu ```Home - Setup - Modules - Deploy external module``` and upload the zip file. +If the module is a ready-to-deploy zip file, so with a name `module_xxx-version.zip` (e.g., when downloading it from a marketplace like [Dolistore](https://www.dolistore.com)), +go to menu `Home> Setup> Modules> Deploy external module` and upload the zip file. -Note: If this screen tell you that there is no "custom" directory, check that your setup is correct: +Note: If this screen tells you that there is no "custom" directory, check that your setup is correct: <!-- -- In your Dolibarr installation directory, edit the ```htdocs/conf/conf.php``` file and check that following lines are not commented: +- In your Dolibarr installation directory, edit the `htdocs/conf/conf.php` file and check that following lines are not commented: ```php //$dolibarr_main_url_root_alt ... //$dolibarr_main_document_root_alt ... ``` -- Uncomment them if necessary (delete the leading ```//```) and assign a sensible value according to your Dolibarr installation +- Uncomment them if necessary (delete the leading `//`) and assign the proper value according to your Dolibarr installation For example : @@ -66,9 +66,9 @@ Note: If this screen tell you that there is no "custom" directory, check that yo ### From a GIT repository -Clone the repository in ```$dolibarr_main_document_root_alt/mymodule``` +Clone the repository in `$dolibarr_main_document_root_alt/mymodule` -```sh +```shell cd ....../custom git clone git@github.com:gitlogin/mymodule.git mymodule ``` @@ -77,10 +77,10 @@ git clone git@github.com:gitlogin/mymodule.git mymodule ### Final steps -From your browser: +Using your browser: - Log into Dolibarr as a super-administrator - - Go to "Setup" -> "Modules" + - Go to "Setup"> "Modules" - You should now be able to find and enable the module @@ -93,4 +93,4 @@ GPLv3 or (at your option) any later version. See file COPYING for more informati ### Documentation -All texts and readmes are licensed under GFDL. +All texts and readme's are licensed under [GFDL](https://www.gnu.org/licenses/fdl-1.3.en.html). diff --git a/htdocs/modulebuilder/template/class/api_mymodule.class.php b/htdocs/modulebuilder/template/class/api_mymodule.class.php index 42c8d9874ba..615bd359b21 100644 --- a/htdocs/modulebuilder/template/class/api_mymodule.class.php +++ b/htdocs/modulebuilder/template/class/api_mymodule.class.php @@ -71,7 +71,7 @@ class MyModuleApi extends DolibarrApi */ public function get($id) { - if (!DolibarrApiAccess::$user->rights->mymodule->myobject->read) { + if (!DolibarrApiAccess::$user->hasRight('mymodule', 'myobject', 'read')) { throw new RestException(403); } if (!DolibarrApi::_checkAccessToResource('myobject', $id, 'mymodule_myobject')) { @@ -110,7 +110,7 @@ class MyModuleApi extends DolibarrApi $obj_ret = array(); $tmpobject = new MyObject($this->db); - if (!DolibarrApiAccess::$user->rights->mymodule->myobject->read) { + if (!DolibarrApiAccess::$user->hasRight('mymodule', 'myobject', 'read')) { throw new RestException(403); } @@ -195,7 +195,7 @@ class MyModuleApi extends DolibarrApi */ public function post($request_data = null) { - if (!DolibarrApiAccess::$user->rights->mymodule->myobject->write) { + if (!DolibarrApiAccess::$user->hasRight('mymodule', 'myobject', 'write')) { throw new RestException(403); } @@ -236,7 +236,7 @@ class MyModuleApi extends DolibarrApi */ public function put($id, $request_data = null) { - if (!DolibarrApiAccess::$user->rights->mymodule->myobject->write) { + if (!DolibarrApiAccess::$user->hasRight('mymodule', 'myobject', 'write')) { throw new RestException(403); } if (!DolibarrApi::_checkAccessToResource('myobject', $id, 'mymodule_myobject')) { diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index f907e1e5843..c905b62543b 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -102,7 +102,7 @@ class MyObject extends CommonObject * 'arrayofkeyval' to set a list of values if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel"). Note that type can be 'integer' or 'varchar' * 'autofocusoncreate' to have field having the focus on a create form. Only 1 field should have this property set to 1. * 'comment' is not used. You can store here any text of your choice. It is not used by application. - * 'validate' is 1 if need to validate with $this->validateField() + * 'validate' is 1 if you need to validate the field with $this->validateField(). Need MAIN_ACTIVATE_VALIDATION_RESULT. * 'copytoclipboard' is 1 or 2 to allow to add a picto to copy value into clipboard (1=picto after label, 2=picto after value) * * Note: To have value dynamic, you can set value to 0 in definition and edit the value on the fly into the constructor. @@ -1211,7 +1211,7 @@ class MyObject extends CommonObject */ public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null) { - global $conf, $langs; + global $langs; $result = 0; $includedocgeneration = 0; @@ -1237,6 +1237,23 @@ class MyObject extends CommonObject return $result; } + /** + * Return validation test result for a field. + * Need MAIN_ACTIVATE_VALIDATION_RESULT to be called. + * + * @param array $fields Array of properties of field to show + * @param string $fieldKey Key of attribute + * @param string $fieldValue value of attribute + * @return bool Return false if fail, true on success, set $this->error for error message + */ + public function validateField($fields, $fieldKey, $fieldValue) + { + // Add your own validation rules here. + // ... + + return parent::validateField($fields, $fieldKey, $fieldValue); + } + /** * Action executed by scheduler * CAN BE A CRON TASK. In such a case, parameters come from the schedule job setup field 'Parameters' diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_advanced.php b/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_advanced.php index 967192deaab..22372c541d1 100644 --- a/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_advanced.php +++ b/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_advanced.php @@ -122,7 +122,7 @@ class mod_myobject_advanced extends ModeleNumRefMyObject * Return next free value * * @param Object $object Object we need next value for - * @return string Value if KO, <0 if KO + * @return string|0 Next value if OK, 0 if KO */ public function getNextValue($object) { diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_standard.php b/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_standard.php index 4260d258ccb..5f7d2f6061f 100644 --- a/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_standard.php +++ b/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_standard.php @@ -117,7 +117,7 @@ class mod_myobject_standard extends ModeleNumRefMyObject * Return next free value * * @param Object $object Object we need next value for - * @return string Value if KO, <0 if KO + * @return string|-1 Next free value if OK, -1 if KO */ public function getNextValue($object) { diff --git a/htdocs/mrp/ajax/interface.php b/htdocs/mrp/ajax/interface.php index 5d9501d13c2..83735a14dc2 100644 --- a/htdocs/mrp/ajax/interface.php +++ b/htdocs/mrp/ajax/interface.php @@ -32,7 +32,7 @@ $action = GETPOST('action', 'alphanohtml'); $result = restrictedArea($user, 'mrp'); -$permissiontoproduce = $user->rights->mrp->write; +$permissiontoproduce = $user->hasRight('mrp', 'write'); diff --git a/htdocs/mrp/class/api_mos.class.php b/htdocs/mrp/class/api_mos.class.php index a339ecad597..d11b66915c4 100644 --- a/htdocs/mrp/class/api_mos.class.php +++ b/htdocs/mrp/class/api_mos.class.php @@ -63,7 +63,7 @@ class Mos extends DolibarrApi */ public function get($id) { - if (!DolibarrApiAccess::$user->rights->mrp->read) { + if (!DolibarrApiAccess::$user->hasRight('mrp', 'read')) { throw new RestException(403); } @@ -97,7 +97,7 @@ class Mos extends DolibarrApi */ public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '', $properties = '') { - if (!DolibarrApiAccess::$user->rights->mrp->read) { + if (!DolibarrApiAccess::$user->hasRight('mrp', 'read')) { throw new RestException(403); } @@ -110,7 +110,7 @@ class Mos extends DolibarrApi // If the internal user must only see his customers, force searching by him $search_sale = 0; - if ($restrictonsocid && !DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) { + if ($restrictonsocid && !DolibarrApiAccess::$user->hasRight('societe', 'client', 'voir') && !$socid) { $search_sale = DolibarrApiAccess::$user->id; } @@ -177,7 +177,7 @@ class Mos extends DolibarrApi */ public function post($request_data = null) { - if (!DolibarrApiAccess::$user->rights->mrp->write) { + if (!DolibarrApiAccess::$user->hasRight('mrp', 'write')) { throw new RestException(403); } // Check mandatory fields @@ -211,7 +211,7 @@ class Mos extends DolibarrApi */ public function put($id, $request_data = null) { - if (!DolibarrApiAccess::$user->rights->mrp->write) { + if (!DolibarrApiAccess::$user->hasRight('mrp', 'write')) { throw new RestException(403); } @@ -254,7 +254,7 @@ class Mos extends DolibarrApi */ public function delete($id) { - if (!DolibarrApiAccess::$user->rights->mrp->delete) { + if (!DolibarrApiAccess::$user->hasRight('mrp', 'delete')) { throw new RestException(403); } $result = $this->mo->fetch($id); @@ -263,7 +263,7 @@ class Mos extends DolibarrApi } if (!DolibarrApi::_checkAccessToResource('mrp', $this->mo->id, 'mrp_mo')) { - throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } if (!$this->mo->delete(DolibarrApiAccess::$user)) { @@ -304,7 +304,7 @@ class Mos extends DolibarrApi $error = 0; - if (!DolibarrApiAccess::$user->rights->mrp->write) { + if (!DolibarrApiAccess::$user->hasRight('mrp', 'write')) { throw new RestException(401, 'Not enough permission'); } $result = $this->mo->fetch($id); diff --git a/htdocs/mrp/mo_card.php b/htdocs/mrp/mo_card.php index 92e1838cad4..39ae023c7c3 100644 --- a/htdocs/mrp/mo_card.php +++ b/htdocs/mrp/mo_card.php @@ -105,9 +105,9 @@ $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); $result = restrictedArea($user, 'mrp', $object->id, 'mrp_mo', '', 'fk_soc', 'rowid', $isdraft); // Permissions -$permissionnote = $user->rights->mrp->write; // Used by the include of actions_setnotes.inc.php -$permissiondellink = $user->rights->mrp->write; // Used by the include of actions_dellink.inc.php -$permissiontoadd = $user->rights->mrp->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php +$permissionnote = $user->hasRight('mrp', 'write'); // Used by the include of actions_setnotes.inc.php +$permissiondellink = $user->hasRight('mrp', 'write'); // Used by the include of actions_dellink.inc.php +$permissiontoadd = $user->hasRight('mrp', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php $permissiontodelete = $user->rights->mrp->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT); $upload_dir = $conf->mrp->multidir_output[isset($object->entity) ? $object->entity : 1]; @@ -837,7 +837,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $relativepath = $objref.'/'.$objref.'.pdf'; $filedir = $conf->mrp->dir_output.'/'.$objref; $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id; - $genallowed = $user->rights->mrp->read; // If you can read, you can build the PDF to read content + $genallowed = $user->hasRight('mrp', 'read'); // If you can read, you can build the PDF to read content $delallowed = $user->hasRight("mrp", "creer"); // If you can create/edit, you can remove a file on card print $formfile->showdocuments('mrp:mo', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $mysoc->default_lang); diff --git a/htdocs/mrp/mo_document.php b/htdocs/mrp/mo_document.php index 505e598c4df..0c7ef6da4e8 100644 --- a/htdocs/mrp/mo_document.php +++ b/htdocs/mrp/mo_document.php @@ -83,7 +83,7 @@ if ($id > 0 || !empty($ref)) { $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); $result = restrictedArea($user, 'mrp', $object->id, 'mrp_mo', '', 'fk_soc', 'rowid', $isdraft); -$permissiontoadd = $user->rights->mrp->write; // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles.inc.php +$permissiontoadd = $user->hasRight('mrp', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles.inc.php /* @@ -180,8 +180,8 @@ if ($object->id) { print dol_get_fiche_end(); $modulepart = 'mrp'; - $permissiontoadd = $user->rights->mrp->write; - $permtoedit = $user->rights->mrp->write; + $permissiontoadd = $user->hasRight('mrp', 'write'); + $permtoedit = $user->hasRight('mrp', 'write'); $param = '&id='.$object->id; //$relativepathwithnofile='mo/' . dol_sanitizeFileName($object->id).'/'; diff --git a/htdocs/mrp/mo_list.php b/htdocs/mrp/mo_list.php index 136345b7c87..f73413914b8 100644 --- a/htdocs/mrp/mo_list.php +++ b/htdocs/mrp/mo_list.php @@ -139,9 +139,9 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); -$permissiontoread = $user->rights->mrp->read; -$permissiontoadd = $user->rights->mrp->write; -$permissiontodelete = $user->rights->mrp->delete; +$permissiontoread = $user->hasRight('mrp', 'read'); +$permissiontoadd = $user->hasRight('mrp', 'write'); +$permissiontodelete = $user->hasRight('mrp', 'delete'); // Security check if ($user->socid > 0) { diff --git a/htdocs/mrp/mo_movements.php b/htdocs/mrp/mo_movements.php index fdb3a0a8366..ca9e1080733 100644 --- a/htdocs/mrp/mo_movements.php +++ b/htdocs/mrp/mo_movements.php @@ -147,9 +147,9 @@ $objectlist->fields = dol_sort_array($objectlist->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); // Permissions -$permissionnote = $user->rights->mrp->write; // Used by the include of actions_setnotes.inc.php -$permissiondellink = $user->rights->mrp->write; // Used by the include of actions_dellink.inc.php -$permissiontoadd = $user->rights->mrp->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php +$permissionnote = $user->hasRight('mrp', 'write'); // Used by the include of actions_setnotes.inc.php +$permissiondellink = $user->hasRight('mrp', 'write'); // Used by the include of actions_dellink.inc.php +$permissiontoadd = $user->hasRight('mrp', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php $permissiontodelete = $user->rights->mrp->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT); $upload_dir = $conf->mrp->multidir_output[isset($object->entity) ? $object->entity : 1]; diff --git a/htdocs/mrp/mo_note.php b/htdocs/mrp/mo_note.php index acdcf02f3bf..32d15e522b0 100644 --- a/htdocs/mrp/mo_note.php +++ b/htdocs/mrp/mo_note.php @@ -60,7 +60,7 @@ if ($id > 0 || !empty($ref)) { $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); $result = restrictedArea($user, 'mrp', $object->id, 'mrp_mo', '', 'fk_soc', 'rowid', $isdraft); -$permissionnote = $user->rights->mrp->write; // Used by the include of actions_setnotes.inc.php +$permissionnote = $user->hasRight('mrp', 'write'); // Used by the include of actions_setnotes.inc.php diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index a0730b6078e..a05ad446a6d 100644 --- a/htdocs/mrp/mo_production.php +++ b/htdocs/mrp/mo_production.php @@ -93,9 +93,9 @@ $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); $result = restrictedArea($user, 'mrp', $object->id, 'mrp_mo', '', 'fk_soc', 'rowid', $isdraft); // Permissions -$permissionnote = $user->rights->mrp->write; // Used by the include of actions_setnotes.inc.php -$permissiondellink = $user->rights->mrp->write; // Used by the include of actions_dellink.inc.php -$permissiontoadd = $user->rights->mrp->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php +$permissionnote = $user->hasRight('mrp', 'write'); // Used by the include of actions_setnotes.inc.php +$permissiondellink = $user->hasRight('mrp', 'write'); // Used by the include of actions_dellink.inc.php +$permissiontoadd = $user->hasRight('mrp', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php $permissiontodelete = $user->rights->mrp->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT); $permissiontoproduce = $permissiontoadd; diff --git a/htdocs/multicurrency/class/api_multicurrencies.class.php b/htdocs/multicurrency/class/api_multicurrencies.class.php index 291de3868a6..7ad88dbee12 100644 --- a/htdocs/multicurrency/class/api_multicurrencies.class.php +++ b/htdocs/multicurrency/class/api_multicurrencies.class.php @@ -57,7 +57,7 @@ class MultiCurrencies extends DolibarrApi { global $db; - if (!DolibarrApiAccess::$user->rights->multicurrency->currency->read) { + if (!DolibarrApiAccess::$user->hasRight('multicurrency', 'currency', 'read')) { throw new RestException(401, "Insufficient rights to read currency"); } @@ -123,7 +123,7 @@ class MultiCurrencies extends DolibarrApi throw new RestException(404, 'Currency not found'); } - if (!DolibarrApiAccess::$user->rights->multicurrency->currency->read) { + if (!DolibarrApiAccess::$user->hasRight('multicurrency', 'currency', 'read')) { throw new RestException(401, "Insufficient rights to read currency"); } @@ -148,7 +148,7 @@ class MultiCurrencies extends DolibarrApi throw new RestException(404, 'Currency not found'); } - if (!DolibarrApiAccess::$user->rights->multicurrency->currency->read) { + if (!DolibarrApiAccess::$user->hasRight('multicurrency', 'currency', 'read')) { throw new RestException(401, "Insufficient rights to read currency"); } @@ -173,7 +173,7 @@ class MultiCurrencies extends DolibarrApi throw new RestException(404, 'Currency not found'); } - if (!DolibarrApiAccess::$user->rights->multicurrency->currency->read) { + if (!DolibarrApiAccess::$user->hasRight('multicurrency', 'currency', 'read')) { throw new RestException(401, "Insufficient rights to read currency rates"); } @@ -199,7 +199,7 @@ class MultiCurrencies extends DolibarrApi */ public function post($request_data = null) { - if (!DolibarrApiAccess::$user->rights->multicurrency->currency->create) { + if (!DolibarrApiAccess::$user->hasRight('multicurrency', 'currency', 'create')) { throw new RestException(401, "Insufficient rights to create currency"); } @@ -243,7 +243,7 @@ class MultiCurrencies extends DolibarrApi */ public function put($id, $request_data = null) { - if (!DolibarrApiAccess::$user->rights->multicurrency->currency->create) { + if (!DolibarrApiAccess::$user->hasRight('multicurrency', 'currency', 'create')) { throw new RestException(401, "Insufficient rights to update currency"); } @@ -282,7 +282,7 @@ class MultiCurrencies extends DolibarrApi */ public function delete($id) { - if (!DolibarrApiAccess::$user->rights->multicurrency->currency->delete) { + if (!DolibarrApiAccess::$user->hasRight('multicurrency', 'currency', 'delete')) { throw new RestException(401, "Insufficient rights to delete currency"); } @@ -316,7 +316,7 @@ class MultiCurrencies extends DolibarrApi */ public function updateRate($id, $request_data = null) { - if (!DolibarrApiAccess::$user->rights->multicurrency->currency->create) { + if (!DolibarrApiAccess::$user->hasRight('multicurrency', 'currency', 'create')) { throw new RestException(401, "Insufficient rights to update currency rate"); } diff --git a/htdocs/opensurvey/card.php b/htdocs/opensurvey/card.php index 68c9c87a707..306a3b590eb 100644 --- a/htdocs/opensurvey/card.php +++ b/htdocs/opensurvey/card.php @@ -61,10 +61,10 @@ $hookmanager->initHooks(array('surveycard', 'globalcard')); $expiredate = dol_mktime(0, 0, 0, GETPOST('expiremonth'), GETPOST('expireday'), GETPOST('expireyear')); -$permissiontoread = $user->rights->opensurvey->read; -$permissiontoadd = $user->rights->opensurvey->write; +$permissiontoread = $user->hasRight('opensurvey', 'read'); +$permissiontoadd = $user->hasRight('opensurvey', 'write'); // permission delete doesn't exists -$permissiontodelete = $user->rights->opensurvey->write; +$permissiontodelete = $user->hasRight('opensurvey', 'write'); /* diff --git a/htdocs/opensurvey/list.php b/htdocs/opensurvey/list.php index ed95a60d577..c9c736840e1 100644 --- a/htdocs/opensurvey/list.php +++ b/htdocs/opensurvey/list.php @@ -107,10 +107,10 @@ if (isset($extrafields->attributes[$object->table_element]['label']) && is_array $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); -$permissiontoread = $user->rights->opensurvey->read; -$permissiontoadd = $user->rights->opensurvey->write; +$permissiontoread = $user->hasRight('opensurvey', 'read'); +$permissiontoadd = $user->hasRight('opensurvey', 'write'); // permission delete doesn't exists -$permissiontodelete = $user->rights->opensurvey->write; +$permissiontodelete = $user->hasRight('opensurvey', 'write'); /* diff --git a/htdocs/partnership/class/api_partnerships.class.php b/htdocs/partnership/class/api_partnerships.class.php index e161f5b154f..b1b23066143 100644 --- a/htdocs/partnership/class/api_partnerships.class.php +++ b/htdocs/partnership/class/api_partnerships.class.php @@ -68,7 +68,7 @@ class Partnerships extends DolibarrApi */ public function get($id) { - if (!DolibarrApiAccess::$user->rights->partnership->read) { + if (!DolibarrApiAccess::$user->hasRight('partnership', 'read')) { throw new RestException(403); } @@ -107,7 +107,7 @@ class Partnerships extends DolibarrApi $obj_ret = array(); $tmpobject = new Partnership($this->db); - if (!DolibarrApiAccess::$user->rights->partnership->read) { + if (!DolibarrApiAccess::$user->hasRight('partnership', 'read')) { throw new RestException(403); } @@ -117,7 +117,7 @@ class Partnerships extends DolibarrApi // If the internal user must only see his customers, force searching by him $search_sale = 0; - if ($restrictonsocid && !DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) { + if ($restrictonsocid && !DolibarrApiAccess::$user->hasRight('societe', 'client', 'voir') && !$socid) { $search_sale = DolibarrApiAccess::$user->id; } @@ -188,7 +188,7 @@ class Partnerships extends DolibarrApi */ public function post($request_data = null) { - if (!DolibarrApiAccess::$user->rights->partnership->write) { + if (!DolibarrApiAccess::$user->hasRight('partnership', 'write')) { throw new RestException(403); } @@ -227,7 +227,7 @@ class Partnerships extends DolibarrApi */ public function put($id, $request_data = null) { - if (!DolibarrApiAccess::$user->rights->partnership->write) { + if (!DolibarrApiAccess::$user->hasRight('partnership', 'write')) { throw new RestException(403); } @@ -275,7 +275,7 @@ class Partnerships extends DolibarrApi */ public function delete($id) { - if (!DolibarrApiAccess::$user->rights->partnership->delete) { + if (!DolibarrApiAccess::$user->hasRight('partnership', 'delete')) { throw new RestException(403); } $result = $this->partnership->fetch($id); @@ -284,7 +284,7 @@ class Partnerships extends DolibarrApi } if (!DolibarrApi::_checkAccessToResource('partnership', $this->partnership->id, 'partnership')) { - throw new RestException(401, 'Access to instance id='.$this->partnership->id.' of object not allowed for login '.DolibarrApiAccess::$user->login); + throw new RestException(403, 'Access to instance id='.$this->partnership->id.' of object not allowed for login '.DolibarrApiAccess::$user->login); } if (!$this->partnership->delete(DolibarrApiAccess::$user)) { diff --git a/htdocs/partnership/class/partnership.class.php b/htdocs/partnership/class/partnership.class.php index 793cf118b64..0849f9ffc2b 100644 --- a/htdocs/partnership/class/partnership.class.php +++ b/htdocs/partnership/class/partnership.class.php @@ -1061,6 +1061,21 @@ class Partnership extends CommonObject return $result; } + /** + * Function used to replace a thirdparty id with another one. + * + * @param DoliDB $db Database handler + * @param int $origin_id Old thirdparty id + * @param int $dest_id New thirdparty id + * @return bool + */ + public static function replaceThirdparty($db, $origin_id, $dest_id) + { + $tables = array('partnership'); + + return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); + } + /** * Return the label of the status * diff --git a/htdocs/partnership/core/modules/partnership/mod_partnership_advanced.php b/htdocs/partnership/core/modules/partnership/mod_partnership_advanced.php index c3b3a888b54..75596eba9ea 100644 --- a/htdocs/partnership/core/modules/partnership/mod_partnership_advanced.php +++ b/htdocs/partnership/core/modules/partnership/mod_partnership_advanced.php @@ -124,7 +124,7 @@ class mod_partnership_advanced extends ModeleNumRefPartnership * Return next free value * * @param Object $object Object we need next value for - * @return string Value if KO, <0 if KO + * @return string|0 Next value if OK, 0 if KO */ public function getNextValue($object) { diff --git a/htdocs/partnership/core/modules/partnership/mod_partnership_standard.php b/htdocs/partnership/core/modules/partnership/mod_partnership_standard.php index f5caef8307b..92c39356a7f 100644 --- a/htdocs/partnership/core/modules/partnership/mod_partnership_standard.php +++ b/htdocs/partnership/core/modules/partnership/mod_partnership_standard.php @@ -117,7 +117,7 @@ class mod_partnership_standard extends ModeleNumRefPartnership * Return next free value * * @param Object $object Object we need next value for - * @return string Value if KO, <0 if KO + * @return string|-1 Next value if OK, -1 if KO */ public function getNextValue($object) { diff --git a/htdocs/partnership/partnership_agenda.php b/htdocs/partnership/partnership_agenda.php index e21f9e8b10b..ede3011d778 100644 --- a/htdocs/partnership/partnership_agenda.php +++ b/htdocs/partnership/partnership_agenda.php @@ -85,8 +85,8 @@ if ($id > 0 || !empty($ref)) { $upload_dir = $conf->partnership->multidir_output[$object->entity]."/".$object->id; } -$permissiontoread = $user->rights->partnership->read; -$permissiontoadd = $user->rights->partnership->write; // Used by the include of actions_addupdatedelete.inc.php +$permissiontoread = $user->hasRight('partnership', 'read'); +$permissiontoadd = $user->hasRight('partnership', 'write'); // Used by the include of actions_addupdatedelete.inc.php $managedfor = getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR', 'thirdparty'); // Security check - Protection if external user diff --git a/htdocs/partnership/partnership_contact.php b/htdocs/partnership/partnership_contact.php index 410a39dcb0a..d1f4d64527c 100644 --- a/htdocs/partnership/partnership_contact.php +++ b/htdocs/partnership/partnership_contact.php @@ -51,8 +51,8 @@ $extrafields->fetch_name_optionals_label($object->table_element); // Load object include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals -$permissiontoread = $user->rights->partnership->read; -$permission = $user->rights->partnership->write; +$permissiontoread = $user->hasRight('partnership', 'read'); +$permission = $user->hasRight('partnership', 'write'); $managedfor = getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR', 'thirdparty'); // Security check - Protection if external user diff --git a/htdocs/partnership/partnership_document.php b/htdocs/partnership/partnership_document.php index 83e226a780b..c0d83257d3a 100644 --- a/htdocs/partnership/partnership_document.php +++ b/htdocs/partnership/partnership_document.php @@ -75,8 +75,8 @@ if ($id > 0 || !empty($ref)) { $upload_dir = $conf->partnership->multidir_output[$object->entity ? $object->entity : $conf->entity]."/partnership/".get_exdir(0, 0, 0, 1, $object); } -$permissiontoread = $user->rights->partnership->read; -$permissiontoadd = $user->rights->partnership->write; // Used by the include of actions_addupdatedelete.inc.php +$permissiontoread = $user->hasRight('partnership', 'read'); +$permissiontoadd = $user->hasRight('partnership', 'write'); // Used by the include of actions_addupdatedelete.inc.php $managedfor = getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR', 'thirdparty'); // Security check - Protection if external user @@ -196,10 +196,6 @@ if ($object->id) { print dol_get_fiche_end(); $modulepart = 'partnership'; - //$permission = $user->rights->partnership->write; - $permission = 1; - //$permtoedit = $user->rights->partnership->write; - $permtoedit = 1; $param = '&id='.$object->id; //$relativepathwithnofile='partnership/' . dol_sanitizeFileName($object->id).'/'; diff --git a/htdocs/partnership/partnership_list.php b/htdocs/partnership/partnership_list.php index cbd2c7aee69..6d97e6cf5f6 100644 --- a/htdocs/partnership/partnership_list.php +++ b/htdocs/partnership/partnership_list.php @@ -150,9 +150,9 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); -$permissiontoread = $user->rights->partnership->read; -$permissiontoadd = $user->rights->partnership->write; -$permissiontodelete = $user->rights->partnership->delete; +$permissiontoread = $user->hasRight('partnership', 'read'); +$permissiontoadd = $user->hasRight('partnership', 'write'); +$permissiontodelete = $user->hasRight('partnership', 'delete'); // Security check - Protection if external user //if ($user->socid > 0) accessforbidden(); diff --git a/htdocs/partnership/partnership_note.php b/htdocs/partnership/partnership_note.php index dec2b76ccb1..7c370057e98 100644 --- a/htdocs/partnership/partnership_note.php +++ b/htdocs/partnership/partnership_note.php @@ -57,9 +57,9 @@ if ($id > 0 || !empty($ref)) { $upload_dir = $conf->partnership->multidir_output[$object->entity]."/".$object->id; } -$permissiontoread = $user->rights->partnership->read; -$permissionnote = $user->rights->partnership->write; // Used by the include of actions_setnotes.inc.php -$permissiontoadd = $user->rights->partnership->write; // Used by the include of actions_addupdatedelete.inc.php +$permissiontoread = $user->hasRight('partnership', 'read'); +$permissionnote = $user->hasRight('partnership', 'write'); // Used by the include of actions_setnotes.inc.php +$permissiontoadd = $user->hasRight('partnership', 'write'); // Used by the include of actions_addupdatedelete.inc.php $managedfor = getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR', 'thirdparty'); // Security check - Protection if external user diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index ced1acc3509..82091a6a1ee 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -180,7 +180,7 @@ class Products extends DolibarrApi { global $db, $conf; - if (!DolibarrApiAccess::$user->rights->produit->lire) { + if (!DolibarrApiAccess::$user->hasRight('produit', 'lire')) { throw new RestException(403); } @@ -252,7 +252,7 @@ class Products extends DolibarrApi if (!$ids_only) { $product_static = new Product($this->db); if ($product_static->fetch($obj->rowid)) { - if (!empty($includestockdata) && DolibarrApiAccess::$user->rights->stock->lire) { + if (!empty($includestockdata) && DolibarrApiAccess::$user->hasRight('stock', 'lire')) { $product_static->load_stock(); if (is_array($product_static->stock_warehouse)) { @@ -306,7 +306,7 @@ class Products extends DolibarrApi */ public function post($request_data = null) { - if (!DolibarrApiAccess::$user->rights->produit->creer) { + if (!DolibarrApiAccess::$user->hasRight('produit', 'creer')) { throw new RestException(403); } // Check mandatory fields @@ -343,7 +343,7 @@ class Products extends DolibarrApi { global $conf; - if (!DolibarrApiAccess::$user->rights->produit->creer) { + if (!DolibarrApiAccess::$user->hasRight('produit', 'creer')) { throw new RestException(403); } @@ -446,7 +446,7 @@ class Products extends DolibarrApi */ public function delete($id) { - if (!DolibarrApiAccess::$user->rights->produit->supprimer) { + if (!DolibarrApiAccess::$user->hasRight('produit', 'supprimer')) { throw new RestException(403); } $result = $this->product->fetch($id); @@ -491,7 +491,7 @@ class Products extends DolibarrApi */ public function getSubproducts($id) { - if (!DolibarrApiAccess::$user->rights->produit->lire) { + if (!DolibarrApiAccess::$user->hasRight('produit', 'lire')) { throw new RestException(403); } @@ -529,7 +529,7 @@ class Products extends DolibarrApi */ public function addSubproducts($id, $subproduct_id, $qty, $incdec = 1) { - if (!DolibarrApiAccess::$user->rights->produit->creer) { + if (!DolibarrApiAccess::$user->hasRight('produit', 'creer')) { throw new RestException(403); } @@ -559,7 +559,7 @@ class Products extends DolibarrApi */ public function delSubproducts($id, $subproduct_id) { - if (!DolibarrApiAccess::$user->rights->produit->creer) { + if (!DolibarrApiAccess::$user->hasRight('produit', 'creer')) { throw new RestException(403); } @@ -590,7 +590,7 @@ class Products extends DolibarrApi */ public function getCategories($id, $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0) { - if (!DolibarrApiAccess::$user->rights->categorie->lire) { + if (!DolibarrApiAccess::$user->hasRight('categorie', 'lire')) { throw new RestException(403); } @@ -618,7 +618,7 @@ class Products extends DolibarrApi { global $conf; - if (!DolibarrApiAccess::$user->rights->produit->lire) { + if (!DolibarrApiAccess::$user->hasRight('produit', 'lire')) { throw new RestException(403); } @@ -660,7 +660,7 @@ class Products extends DolibarrApi { global $conf; - if (!DolibarrApiAccess::$user->rights->produit->lire) { + if (!DolibarrApiAccess::$user->hasRight('produit', 'lire')) { throw new RestException(403); } @@ -709,7 +709,7 @@ class Products extends DolibarrApi { global $conf; - if (!DolibarrApiAccess::$user->rights->produit->lire) { + if (!DolibarrApiAccess::$user->hasRight('produit', 'lire')) { throw new RestException(403); } @@ -767,7 +767,7 @@ class Products extends DolibarrApi */ public function addPurchasePrice($id, $qty, $buyprice, $price_base_type, $fourn_id, $availability, $ref_fourn, $tva_tx, $charges = 0, $remise_percent = 0, $remise = 0, $newnpr = 0, $delivery_time_days = 0, $supplier_reputation = '', $localtaxes_array = array(), $newdefaultvatcode = '', $multicurrency_buyprice = 0, $multicurrency_price_base_type = 'HT', $multicurrency_tx = 1, $multicurrency_code = '', $desc_fourn = '', $barcode = '', $fk_barcode_type = null) { - if (!DolibarrApiAccess::$user->rights->produit->creer) { + if (!DolibarrApiAccess::$user->hasRight('produit', 'creer')) { throw new RestException(403); } @@ -825,7 +825,7 @@ class Products extends DolibarrApi */ public function deletePurchasePrice($id, $priceid) { - if (!DolibarrApiAccess::$user->rights->produit->supprimer) { + if (!DolibarrApiAccess::$user->hasRight('produit', 'supprimer')) { throw new RestException(403); } $result = $this->productsupplier->fetch($id); @@ -864,7 +864,7 @@ class Products extends DolibarrApi { global $db, $conf; - if (!DolibarrApiAccess::$user->rights->produit->lire) { + if (!DolibarrApiAccess::$user->hasRight('produit', 'lire')) { throw new RestException(403); } @@ -977,7 +977,7 @@ class Products extends DolibarrApi $id = (empty($id) ? 0 : $id); - if (!DolibarrApiAccess::$user->rights->produit->lire) { + if (!DolibarrApiAccess::$user->hasRight('produit', 'lire')) { throw new RestException(403); } @@ -1025,7 +1025,7 @@ class Products extends DolibarrApi */ public function getAttributes($sortfield = "t.ref", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '', $properties = '') { - if (!DolibarrApiAccess::$user->rights->produit->lire) { + if (!DolibarrApiAccess::$user->hasRight('produit', 'lire')) { throw new RestException(403); } @@ -1087,7 +1087,7 @@ class Products extends DolibarrApi */ public function getAttributeById($id) { - if (!DolibarrApiAccess::$user->rights->produit->lire) { + if (!DolibarrApiAccess::$user->hasRight('produit', 'lire')) { throw new RestException(403); } @@ -1130,7 +1130,7 @@ class Products extends DolibarrApi */ public function getAttributesByRef($ref) { - if (!DolibarrApiAccess::$user->rights->produit->lire) { + if (!DolibarrApiAccess::$user->hasRight('produit', 'lire')) { throw new RestException(403); } @@ -1180,7 +1180,7 @@ class Products extends DolibarrApi */ public function getAttributesByRefExt($ref_ext) { - if (!DolibarrApiAccess::$user->rights->produit->lire) { + if (!DolibarrApiAccess::$user->hasRight('produit', 'lire')) { throw new RestException(403); } @@ -1232,7 +1232,7 @@ class Products extends DolibarrApi */ public function addAttributes($ref, $label, $ref_ext = '') { - if (!DolibarrApiAccess::$user->rights->produit->creer) { + if (!DolibarrApiAccess::$user->hasRight('produit', 'creer')) { throw new RestException(403); } @@ -1264,7 +1264,7 @@ class Products extends DolibarrApi */ public function putAttributes($id, $request_data = null) { - if (!DolibarrApiAccess::$user->rights->produit->creer) { + if (!DolibarrApiAccess::$user->hasRight('produit', 'creer')) { throw new RestException(403); } @@ -1316,7 +1316,7 @@ class Products extends DolibarrApi */ public function deleteAttributes($id) { - if (!DolibarrApiAccess::$user->rights->produit->supprimer) { + if (!DolibarrApiAccess::$user->hasRight('produit', 'supprimer')) { throw new RestException(403); } @@ -1344,7 +1344,7 @@ class Products extends DolibarrApi */ public function getAttributeValueById($id) { - if (!DolibarrApiAccess::$user->rights->produit->lire) { + if (!DolibarrApiAccess::$user->hasRight('produit', 'lire')) { throw new RestException(403); } @@ -1385,7 +1385,7 @@ class Products extends DolibarrApi */ public function getAttributeValueByRef($id, $ref) { - if (!DolibarrApiAccess::$user->rights->produit->lire) { + if (!DolibarrApiAccess::$user->hasRight('produit', 'lire')) { throw new RestException(403); } @@ -1428,7 +1428,7 @@ class Products extends DolibarrApi */ public function deleteAttributeValueByRef($id, $ref) { - if (!DolibarrApiAccess::$user->rights->produit->supprimer) { + if (!DolibarrApiAccess::$user->hasRight('produit', 'supprimer')) { throw new RestException(403); } @@ -1471,7 +1471,7 @@ class Products extends DolibarrApi */ public function getAttributeValues($id) { - if (!DolibarrApiAccess::$user->rights->produit->lire) { + if (!DolibarrApiAccess::$user->hasRight('produit', 'lire')) { throw new RestException(403); } @@ -1502,7 +1502,7 @@ class Products extends DolibarrApi */ public function getAttributeValuesByRef($ref) { - if (!DolibarrApiAccess::$user->rights->produit->lire) { + if (!DolibarrApiAccess::$user->hasRight('produit', 'lire')) { throw new RestException(403); } @@ -1544,7 +1544,7 @@ class Products extends DolibarrApi */ public function addAttributeValue($id, $ref, $value) { - if (!DolibarrApiAccess::$user->rights->produit->creer) { + if (!DolibarrApiAccess::$user->hasRight('produit', 'creer')) { throw new RestException(403); } @@ -1577,7 +1577,7 @@ class Products extends DolibarrApi */ public function putAttributeValue($id, $request_data) { - if (!DolibarrApiAccess::$user->rights->produit->creer) { + if (!DolibarrApiAccess::$user->hasRight('produit', 'creer')) { throw new RestException(403); } @@ -1629,7 +1629,7 @@ class Products extends DolibarrApi */ public function deleteAttributeValueById($id) { - if (!DolibarrApiAccess::$user->rights->produit->supprimer) { + if (!DolibarrApiAccess::$user->hasRight('produit', 'supprimer')) { throw new RestException(403); } @@ -1656,7 +1656,7 @@ class Products extends DolibarrApi */ public function getVariants($id, $includestock = 0) { - if (!DolibarrApiAccess::$user->rights->produit->lire) { + if (!DolibarrApiAccess::$user->hasRight('produit', 'lire')) { throw new RestException(403); } @@ -1668,7 +1668,7 @@ class Products extends DolibarrApi $combinations[$key]->attributes = $prodc2vp->fetchByFkCombination((int) $combination->id); $combinations[$key] = $this->_cleanObjectDatas($combinations[$key]); - if (!empty($includestock) && DolibarrApiAccess::$user->rights->stock->lire) { + if (!empty($includestock) && DolibarrApiAccess::$user->hasRight('stock', 'lire')) { $productModel = new Product($this->db); $productModel->fetch((int) $combination->fk_product_child); $productModel->load_stock($includestock); @@ -1692,7 +1692,7 @@ class Products extends DolibarrApi */ public function getVariantsByProdRef($ref) { - if (!DolibarrApiAccess::$user->rights->produit->lire) { + if (!DolibarrApiAccess::$user->hasRight('produit', 'lire')) { throw new RestException(403); } @@ -1735,7 +1735,7 @@ class Products extends DolibarrApi */ public function addVariant($id, $weight_impact, $price_impact, $price_impact_is_percent, $features, $reference = '', $ref_ext = '') { - if (!DolibarrApiAccess::$user->rights->produit->creer) { + if (!DolibarrApiAccess::$user->hasRight('produit', 'creer')) { throw new RestException(403); } @@ -1796,7 +1796,7 @@ class Products extends DolibarrApi */ public function addVariantByProductRef($ref, $weight_impact, $price_impact, $price_impact_is_percent, $features) { - if (!DolibarrApiAccess::$user->rights->produit->creer) { + if (!DolibarrApiAccess::$user->hasRight('produit', 'creer')) { throw new RestException(403); } @@ -1850,7 +1850,7 @@ class Products extends DolibarrApi */ public function putVariant($id, $request_data = null) { - if (!DolibarrApiAccess::$user->rights->produit->creer) { + if (!DolibarrApiAccess::$user->hasRight('produit', 'creer')) { throw new RestException(403); } @@ -1890,7 +1890,7 @@ class Products extends DolibarrApi */ public function deleteVariant($id) { - if (!DolibarrApiAccess::$user->rights->produit->supprimer) { + if (!DolibarrApiAccess::$user->hasRight('produit', 'supprimer')) { throw new RestException(403); } @@ -1912,19 +1912,19 @@ class Products extends DolibarrApi * @return array * * @throws RestException 500 System error - * @throws RestException 401 + * @throws RestException 403 * @throws RestException 404 * * @url GET {id}/stock */ public function getStock($id, $selected_warehouse_id = null) { - if (!DolibarrApiAccess::$user->rights->produit->lire || !DolibarrApiAccess::$user->rights->stock->lire) { + if (!DolibarrApiAccess::$user->hasRight('produit', 'lire') || !DolibarrApiAccess::$user->hasRight('stock', 'lire')) { throw new RestException(403); } if (!DolibarrApi::_checkAccessToResource('product', $id)) { - throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } $product_model = new Product($this->db); @@ -2001,7 +2001,7 @@ class Products extends DolibarrApi unset($object->supplierprices); // Must use another API to get them - if (empty(DolibarrApiAccess::$user->rights->stock->lire)) { + if (!DolibarrApiAccess::$user->hasRight('stock', 'lire')) { unset($object->stock_reel); unset($object->stock_theorique); unset($object->stock_warehouse); @@ -2056,7 +2056,7 @@ class Products extends DolibarrApi $id = (empty($id) ? 0 : $id); - if (!DolibarrApiAccess::$user->rights->produit->lire) { + if (!DolibarrApiAccess::$user->hasRight('produit', 'lire')) { throw new RestException(403); } @@ -2069,7 +2069,7 @@ class Products extends DolibarrApi throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } - if (!empty($includestockdata) && DolibarrApiAccess::$user->rights->stock->lire) { + if (!empty($includestockdata) && DolibarrApiAccess::$user->hasRight('stock', 'lire')) { $this->product->load_stock($includestockdata); if (is_array($this->product->stock_warehouse)) { diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index b96f38b7cf4..5d68345b302 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -594,6 +594,7 @@ class Product extends CommonObject 'localtax1_type' => array('type'=>'varchar(10)', 'label'=>'Localtax1type', 'enabled'=>'1', 'position'=>155, 'notnull'=>1, 'visible'=>-1,), 'localtax2_tx' => array('type'=>'double(6,3)', 'label'=>'Localtax2tx', 'enabled'=>'1', 'position'=>160, 'notnull'=>0, 'visible'=>-1,), 'localtax2_type' => array('type'=>'varchar(10)', 'label'=>'Localtax2type', 'enabled'=>'1', 'position'=>165, 'notnull'=>1, 'visible'=>-1,), + 'last_main_doc' => array('type'=>'varchar(255)', 'label'=>'LastMainDoc', 'enabled'=>1, 'visible'=>-1, 'position'=>170), 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'index'=>0, 'position'=>1000), //'tosell' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'default'=>0, 'index'=>1, 'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Active', -1=>'Cancel')), //'tobuy' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'default'=>0, 'index'=>1, 'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Active', -1=>'Cancel')), @@ -2538,7 +2539,7 @@ class Product extends CommonObject $sql = "SELECT p.rowid, p.ref, p.ref_ext, p.label, p.description, p.url, p.note_public, p.note as note_private, p.customcode, p.fk_country, p.fk_state, p.lifetime, p.qc_frequency, p.price, p.price_ttc,"; $sql .= " p.price_min, p.price_min_ttc, p.price_base_type, p.cost_price, p.default_vat_code, p.tva_tx, p.recuperableonly as tva_npr, p.localtax1_tx, p.localtax2_tx, p.localtax1_type, p.localtax2_type, p.tosell,"; $sql .= " p.tobuy, p.fk_product_type, p.duration, p.fk_default_warehouse, p.fk_default_workstation, p.seuil_stock_alerte, p.canvas, p.net_measure, p.net_measure_units, p.weight, p.weight_units,"; - $sql .= " p.length, p.length_units, p.width, p.width_units, p.height, p.height_units,"; + $sql .= " p.length, p.length_units, p.width, p.width_units, p.height, p.height_units, p.last_main_doc,"; $sql .= " p.surface, p.surface_units, p.volume, p.volume_units, p.barcode, p.fk_barcode_type, p.finished, p.fk_default_bom, p.mandatory_period,"; if (!getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) { $sql .= " p.accountancy_code_buy, p.accountancy_code_buy_intra, p.accountancy_code_buy_export, p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export,"; @@ -2714,6 +2715,7 @@ class Product extends CommonObject $this->fk_unit = $obj->fk_unit; $this->price_autogen = $obj->price_autogen; $this->model_pdf = $obj->model_pdf; + $this->last_main_doc = $obj->last_main_doc; $this->mandatory_period = $obj->mandatory_period; diff --git a/htdocs/product/class/productbatch.class.php b/htdocs/product/class/productbatch.class.php index cac5d5c05ee..01a1c8a8b41 100644 --- a/htdocs/product/class/productbatch.class.php +++ b/htdocs/product/class/productbatch.class.php @@ -372,7 +372,7 @@ class Productbatch extends CommonObject } /** - * Find first detail record that match eather eat-by or sell-by or batch within given warehouse + * Find first detailed record that match either eat-by, sell-by or batch within the warehouse * * @param int $fk_product_stock id product_stock for object * @param integer $eatby eat-by date for object - deprecated: a search must be done on batch number diff --git a/htdocs/product/class/propalmergepdfproduct.class.php b/htdocs/product/class/propalmergepdfproduct.class.php index bc6491955fc..b691e6d6316 100644 --- a/htdocs/product/class/propalmergepdfproduct.class.php +++ b/htdocs/product/class/propalmergepdfproduct.class.php @@ -41,19 +41,39 @@ class Propalmergepdfproduct extends CommonObject */ public $table_element = 'propal_merge_pdf_product'; + /** + * @var int Id of product + */ public $fk_product; + + /** + * @var string Filename + */ public $file_name; + + /** + * @var int Id user + */ public $fk_user_author; + + /** + * @var int Id user + */ public $fk_user_mod; public $datec = ''; public $tms = ''; + + /** + * @var string lang code + */ public $lang; + /** + * @var PropalmergepdfproductLine[] + */ public $lines = array(); - - /** * Constructor * @@ -80,16 +100,16 @@ class Propalmergepdfproduct extends CommonObject // Clean parameters if (isset($this->fk_product)) { - $this->fk_product = trim($this->fk_product); + $this->fk_product = (int) $this->fk_product; } if (isset($this->file_name)) { $this->file_name = trim($this->file_name); } if (isset($this->fk_user_author)) { - $this->fk_user_author = trim($this->fk_user_author); + $this->fk_user_author = (int) $this->fk_user_author; } if (isset($this->fk_user_mod)) { - $this->fk_user_mod = trim($this->fk_user_mod); + $this->fk_user_mod = (int) $this->fk_user_mod; } if (isset($this->lang)) { $this->lang = trim($this->lang); @@ -99,7 +119,6 @@ class Propalmergepdfproduct extends CommonObject } - // Check parameters // Put here code to add control on parameters values @@ -535,10 +554,10 @@ class Propalmergepdfproduct extends CommonObject { $this->id = 0; - $this->fk_product = ''; + $this->fk_product = 0; $this->file_name = ''; - $this->fk_user_author = ''; - $this->fk_user_mod = ''; + $this->fk_user_author = 0; + $this->fk_user_mod = 0; $this->datec = ''; $this->tms = ''; $this->import_key = ''; @@ -560,7 +579,14 @@ class PropalmergepdfproductLine */ public $fk_product; + /** + * @var string Filename + */ public $file_name; + + /** + * @var string Code lang + */ public $lang; /** diff --git a/htdocs/product/composition/card.php b/htdocs/product/composition/card.php index 1e86a7bedce..0590e1f541d 100644 --- a/htdocs/product/composition/card.php +++ b/htdocs/product/composition/card.php @@ -76,9 +76,9 @@ if ($object->id > 0) { } else { restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype); } -$usercanread = (($object->type == Product::TYPE_PRODUCT && $user->rights->produit->lire) || ($object->type == Product::TYPE_SERVICE && $user->hasRight('service', 'lire'))); -$usercancreate = (($object->type == Product::TYPE_PRODUCT && $user->rights->produit->creer) || ($object->type == Product::TYPE_SERVICE && $user->hasRight('service', 'creer'))); -$usercandelete = (($object->type == Product::TYPE_PRODUCT && $user->rights->produit->supprimer) || ($object->type == Product::TYPE_SERVICE && $user->rights->service->supprimer)); +$usercanread = (($object->type == Product::TYPE_PRODUCT && $user->hasRight('produit', 'lire')) || ($object->type == Product::TYPE_SERVICE && $user->hasRight('service', 'lire'))); +$usercancreate = (($object->type == Product::TYPE_PRODUCT && $user->hasRight('produit', 'creer')) || ($object->type == Product::TYPE_SERVICE && $user->hasRight('service', 'creer'))); +$usercandelete = (($object->type == Product::TYPE_PRODUCT && $user->hasRight('produit', 'supprimer')) || ($object->type == Product::TYPE_SERVICE && $user->hasRight('service', 'supprimer'))); /* diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index aba181da8f9..84437ca0b05 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -108,8 +108,8 @@ if ($id > 0 || $ref) { $prod->fetch($id, $ref); } -$usercanread = (($object->type == Product::TYPE_PRODUCT && $user->rights->produit->lire) || ($object->type == Product::TYPE_SERVICE && $user->hasRight('service', 'lire'))); -$usercancreate = (($object->type == Product::TYPE_PRODUCT && $user->rights->produit->creer) || ($object->type == Product::TYPE_SERVICE && $user->hasRight('service', 'creer'))); +$usercanread = (($object->type == Product::TYPE_PRODUCT && $user->hasRight('produit', 'lire')) || ($object->type == Product::TYPE_SERVICE && $user->hasRight('service', 'lire'))); +$usercancreate = (($object->type == Product::TYPE_PRODUCT && $user->hasRight('produit', 'creer')) || ($object->type == Product::TYPE_SERVICE && $user->hasRight('service', 'creer'))); if ($object->id > 0) { if ($object->type == $object::TYPE_PRODUCT) { @@ -302,7 +302,7 @@ if (empty($reshook)) { if (empty($packaging)) { $packaging = 1; } - /* We can have a puchase ref that need to buy 100 min for a given price and with a packaging of 50. + /* We can have a purchase ref that need to buy 100 min for a given price and with a packaging of 50. if ($packaging < $quantity) { $packaging = $quantity; }*/ diff --git a/htdocs/product/inventory/card.php b/htdocs/product/inventory/card.php index 26d7986bdc6..55f04b96523 100644 --- a/htdocs/product/inventory/card.php +++ b/htdocs/product/inventory/card.php @@ -84,18 +84,18 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be includ //$result = restrictedArea($user, 'mymodule', $id); if (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) { - $permissiontoread = $user->rights->stock->lire; - $permissiontoadd = $user->rights->stock->creer; - $permissiontodelete = $user->rights->stock->supprimer; - $permissionnote = $user->rights->stock->creer; // Used by the include of actions_setnotes.inc.php - $permissiondellink = $user->rights->stock->creer; // Used by the include of actions_dellink.inc.php + $permissiontoread = $user->hasRight('stock', 'lire'); + $permissiontoadd = $user->hasRight('stock', 'creer'); + $permissiontodelete = $user->hasRight('stock', 'supprimer'); + $permissionnote = $user->hasRight('stock', 'creer'); // Used by the include of actions_setnotes.inc.php + $permissiondellink = $user->hasRight('stock', 'creer'); // Used by the include of actions_dellink.inc.php $upload_dir = $conf->stock->multidir_output[isset($object->entity) ? $object->entity : 1]; } else { - $permissiontoread = $user->rights->stock->inventory_advance->read; - $permissiontoadd = $user->rights->stock->inventory_advance->write; - $permissiontodelete = $user->rights->stock->inventory_advance->delete; - $permissionnote = $user->rights->stock->inventory_advance->write; // Used by the include of actions_setnotes.inc.php - $permissiondellink = $user->rights->stock->inventory_advance->write; // Used by the include of actions_dellink.inc.php + $permissiontoread = $user->hasRight('stock', 'inventory_advance', 'read'); + $permissiontoadd = $user->hasRight('stock', 'inventory_advance', 'write'); + $permissiontodelete = $user->hasRight('stock', 'inventory_advance', 'delete'); + $permissionnote = $user->hasRight('stock', 'inventory_advance', 'write'); // Used by the include of actions_setnotes.inc.php + $permissiondellink = $user->hasRight('stock', 'inventory_advance', 'write'); // Used by the include of actions_dellink.inc.php $upload_dir = $conf->stock->multidir_output[isset($object->entity) ? $object->entity : 1]; } @@ -466,8 +466,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $relativepath = $objref.'/'.$objref.'.pdf'; $filedir = $conf->mymodule->dir_output.'/'.$object->element.'/'.$objref; $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id; - $genallowed = $user->rights->mymodule->myobject->read; // If you can read, you can build the PDF to read content - $delallowed = $user->rights->mymodule->myobject->write; // If you can create/edit, you can remove a file on card + $genallowed = $user->hasRight('mymodule', 'myobject', 'read'); // If you can read, you can build the PDF to read content + $delallowed = $user->hasRight('mymodule', 'myobject', 'write'); // If you can create/edit, you can remove a file on card print $formfile->showdocuments('mymodule:MyObject', $object->element.'/'.$objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang); } diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php index 6decd5e6f4a..cd8ee975ed4 100644 --- a/htdocs/product/inventory/inventory.php +++ b/htdocs/product/inventory/inventory.php @@ -104,11 +104,11 @@ if ($limit > 0 && $limit != $conf->liste_limit) { if (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) { - $permissiontoadd = $user->rights->stock->creer; - $permissiontodelete = $user->rights->stock->supprimer; + $permissiontoadd = $user->hasRight('stock', 'creer'); + $permissiontodelete = $user->hasRight('stock', 'supprimer'); } else { - $permissiontoadd = $user->rights->stock->inventory_advance->write; - $permissiontodelete = $user->rights->stock->inventory_advance->write; + $permissiontoadd = $user->hasRight('stock', 'inventory_advance', 'write'); + $permissiontodelete = $user->hasRight('stock', 'inventory_advance', 'write'); } $now = dol_now(); diff --git a/htdocs/product/inventory/list.php b/htdocs/product/inventory/list.php index 3acbf368d5f..4424024dee7 100644 --- a/htdocs/product/inventory/list.php +++ b/htdocs/product/inventory/list.php @@ -129,9 +129,9 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); -$permissiontoread = $user->rights->stock->lire; -$permissiontoadd = $user->rights->stock->creer; -$permissiontodelete = $user->rights->stock->supprimer; +$permissiontoread = $user->hasRight('stock', 'lire'); +$permissiontoadd = $user->hasRight('stock', 'creer'); +$permissiontodelete = $user->hasRight('stock', 'supprimer'); // Security check $socid = 0; diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 0a3aca5452d..3b137f8f88d 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -249,10 +249,10 @@ $arrayfields = array( 'p.fk_default_workstation'=>array('label'=>'DefaultWorkstation', 'checked'=>0, 'enabled'=>isModEnabled('workstation') && $type == 1, 'position'=>33), 'p.sellprice'=>array('label'=>"SellingPrice", 'checked'=>1, 'enabled'=>!getDolGlobalString('PRODUIT_MULTIPRICES'), 'position'=>40), 'p.tva_tx'=>array('label'=>"VATRate", 'checked'=>0, 'enabled'=>!getDolGlobalString('PRODUIT_MULTIPRICES'), 'position'=>41), - 'p.minbuyprice'=>array('label'=>"BuyingPriceMinShort", 'checked'=>1, 'enabled'=>(!empty($user->rights->fournisseur->lire)), 'position'=>42), - 'p.numbuyprice'=>array('label'=>"BuyingPriceNumShort", 'checked'=>0, 'enabled'=>(!empty($user->rights->fournisseur->lire)), 'position'=>43), - 'p.pmp'=>array('label'=>"PMPValueShort", 'checked'=>0, 'enabled'=>(!empty($user->rights->fournisseur->lire)), 'position'=>44), - 'p.cost_price'=>array('label'=>"CostPrice", 'checked'=>0, 'enabled'=>(!empty($user->rights->fournisseur->lire)), 'position'=>45), + 'p.minbuyprice'=>array('label'=>"BuyingPriceMinShort", 'checked'=>1, 'enabled'=>($user->hasRight('fournisseur', 'lire')), 'position'=>42), + 'p.numbuyprice'=>array('label'=>"BuyingPriceNumShort", 'checked'=>0, 'enabled'=>($user->hasRight('fournisseur', 'lire')), 'position'=>43), + 'p.pmp'=>array('label'=>"PMPValueShort", 'checked'=>0, 'enabled'=>($user->hasRight('fournisseur', 'lire')), 'position'=>44), + 'p.cost_price'=>array('label'=>"CostPrice", 'checked'=>0, 'enabled'=>($user->hasRight('fournisseur', 'lire')), 'position'=>45), 'p.seuil_stock_alerte'=>array('label'=>"StockLimit", 'checked'=>0, 'enabled'=>(isModEnabled('stock') && $user->hasRight('stock', 'lire') && ($contextpage != 'servicelist' || getDolGlobalString('STOCK_SUPPORTS_SERVICES'))), 'position'=>50), 'p.desiredstock'=>array('label'=>"DesiredStock", 'checked'=>1, 'enabled'=>(isModEnabled('stock') && $user->hasRight('stock', 'lire') && ($contextpage != 'servicelist' || getDolGlobalString('STOCK_SUPPORTS_SERVICES'))), 'position'=>51), 'p.stock'=>array('label'=>"PhysicalStock", 'checked'=>1, 'enabled'=>(isModEnabled('stock') && $user->hasRight('stock', 'lire') && ($contextpage != 'servicelist' || getDolGlobalString('STOCK_SUPPORTS_SERVICES'))), 'position'=>52), diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index 5db1a837a01..a5c32a79043 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -92,9 +92,9 @@ if ($id > 0 || !empty($ref)) { } } -$usercanread = (($user->rights->stock->lire)); -$usercancreate = (($user->rights->stock->creer)); -$usercandelete = (($user->rights->stock->supprimer)); +$usercanread = (($user->hasRight('stock', 'lire'))); +$usercancreate = (($user->hasRight('stock', 'creer'))); +$usercandelete = (($user->hasRight('stock', 'supprimer'))); /* @@ -267,7 +267,7 @@ if (empty($reshook)) { // Actions to build doc $upload_dir = $conf->stock->dir_output; - $permissiontoadd = $user->rights->stock->creer; + $permissiontoadd = $user->hasRight('stock', 'creer'); include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; } diff --git a/htdocs/product/stock/class/api_stockmovements.class.php b/htdocs/product/stock/class/api_stockmovements.class.php index 38e0ba177b2..c198d60aadb 100644 --- a/htdocs/product/stock/class/api_stockmovements.class.php +++ b/htdocs/product/stock/class/api_stockmovements.class.php @@ -65,16 +65,16 @@ class StockMovements extends DolibarrApi /* public function get($id) { - if(! DolibarrApiAccess::$user->rights->stock->lire) { + if (!DolibarrApiAccess::$user->hasRight('stock', 'lire')) { throw new RestException(403); } $result = $this->stockmovement->fetch($id); - if( ! $result ) { + if (!$result ) { throw new RestException(404, 'warehouse not found'); } - if( ! DolibarrApi::_checkAccessToResource('warehouse',$this->stockmovement->id)) { + if (!DolibarrApi::_checkAccessToResource('warehouse',$this->stockmovement->id)) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } @@ -100,7 +100,7 @@ class StockMovements extends DolibarrApi $obj_ret = array(); - if (!DolibarrApiAccess::$user->rights->stock->lire) { + if (!DolibarrApiAccess::$user->hasRight('stock', 'lire')) { throw new RestException(403); } @@ -175,7 +175,7 @@ class StockMovements extends DolibarrApi */ public function post($product_id, $warehouse_id, $qty, $type = 2, $lot = '', $movementcode = '', $movementlabel = '', $price = '', $datem = '', $dlc = '', $dluo = '', $origin_type = '', $origin_id = 0) { - if (!DolibarrApiAccess::$user->rights->stock->creer) { + if (!DolibarrApiAccess::$user->hasRight('stock', 'creer')) { throw new RestException(403); } @@ -218,7 +218,7 @@ class StockMovements extends DolibarrApi /* public function put($id, $request_data = null) { - if(! DolibarrApiAccess::$user->rights->stock->creer) { + if(! DolibarrApiAccess::$user->hasRight('stock', 'creer')) { throw new RestException(403); } @@ -251,15 +251,15 @@ class StockMovements extends DolibarrApi /* public function delete($id) { - if(! DolibarrApiAccess::$user->rights->stock->supprimer) { + if (! DolibarrApiAccess::$user->hasRight('stock', 'supprimer')) { throw new RestException(403); } $result = $this->stockmovement->fetch($id); - if( ! $result ) { + if (! $result ) { throw new RestException(404, 'stock movement not found'); } - if( ! DolibarrApi::_checkAccessToResource('stock',$this->stockmovement->id)) { + if (! DolibarrApi::_checkAccessToResource('stock',$this->stockmovement->id)) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } diff --git a/htdocs/product/stock/class/api_warehouses.class.php b/htdocs/product/stock/class/api_warehouses.class.php index a8ef5480eee..c03ba11c01d 100644 --- a/htdocs/product/stock/class/api_warehouses.class.php +++ b/htdocs/product/stock/class/api_warehouses.class.php @@ -62,7 +62,7 @@ class Warehouses extends DolibarrApi */ public function get($id) { - if (!DolibarrApiAccess::$user->rights->stock->lire) { + if (!DolibarrApiAccess::$user->hasRight('stock', 'lire')) { throw new RestException(403); } @@ -100,7 +100,7 @@ class Warehouses extends DolibarrApi $obj_ret = array(); - if (!DolibarrApiAccess::$user->rights->stock->lire) { + if (!DolibarrApiAccess::$user->hasRight('stock', 'lire')) { throw new RestException(403); } @@ -163,7 +163,7 @@ class Warehouses extends DolibarrApi */ public function post($request_data = null) { - if (!DolibarrApiAccess::$user->rights->stock->creer) { + if (!DolibarrApiAccess::$user->hasRight('stock', 'creer')) { throw new RestException(403); } @@ -194,7 +194,7 @@ class Warehouses extends DolibarrApi */ public function put($id, $request_data = null) { - if (!DolibarrApiAccess::$user->rights->stock->creer) { + if (!DolibarrApiAccess::$user->hasRight('stock', 'creer')) { throw new RestException(403); } @@ -235,7 +235,7 @@ class Warehouses extends DolibarrApi */ public function delete($id) { - if (!DolibarrApiAccess::$user->rights->stock->supprimer) { + if (!DolibarrApiAccess::$user->hasRight('stock', 'supprimer')) { throw new RestException(403); } $result = $this->warehouse->fetch($id); diff --git a/htdocs/product/stock/class/productlot.class.php b/htdocs/product/stock/class/productlot.class.php index 7b6089e2028..0aeecdd3cbb 100644 --- a/htdocs/product/stock/class/productlot.class.php +++ b/htdocs/product/stock/class/productlot.class.php @@ -103,7 +103,7 @@ class Productlot extends CommonObject public $fields = array( 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'noteditable'=>1, 'notnull'=> 1, 'index'=>1, 'position'=>1, 'comment'=>'Id', 'css'=>'left'), 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>5, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'picto' => 'product', 'css'=>'maxwidth500 widthcentpercentminusxx', 'csslist'=>'maxwidth150'), - 'batch' => array('type'=>'varchar(30)', 'label'=>'Batch', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'comment'=>'Batch', 'searchall'=>1, 'picto'=>'lot'), + 'batch' => array('type'=>'varchar(30)', 'label'=>'Batch', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'comment'=>'Batch', 'searchall'=>1, 'picto'=>'lot', 'validate'=>1), 'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'default'=>1, 'notnull'=>1, 'index'=>1, 'position'=>20), 'sellby' => array('type'=>'date', 'label'=>'SellByDate', 'enabled'=>'empty($conf->global->PRODUCT_DISABLE_SELLBY)?1:0', 'visible'=>1, 'notnull'=>0, 'position'=>60), 'eatby' => array('type'=>'date', 'label'=>'EatByDate', 'enabled'=>'empty($conf->global->PRODUCT_DISABLE_EATBY)?1:0', 'visible'=>1, 'notnull'=>0, 'position'=>62), @@ -775,7 +775,7 @@ class Productlot extends CommonObject public function loadStatsExpedition($socid = 0) { // phpcs:enable - global $db, $conf, $user, $hookmanager, $action; + global $user, $hookmanager, $action; $sql = "SELECT COUNT(DISTINCT exp.fk_soc) as nb_customers, COUNT(DISTINCT exp.rowid) as nb,"; $sql .= " COUNT(ed.rowid) as nb_rows, SUM(edb.qty) as qty"; @@ -850,7 +850,7 @@ class Productlot extends CommonObject public function loadStatsSupplierOrder($socid = 0) { // phpcs:enable - global $db, $conf, $user, $hookmanager, $action; + global $user, $hookmanager, $action; $sql = "SELECT COUNT(DISTINCT cf.fk_soc) as nb_customers, COUNT(DISTINCT cf.rowid) as nb,"; $sql .= " COUNT(cfd.rowid) as nb_rows, SUM(cfdi.qty) as qty"; @@ -925,7 +925,7 @@ class Productlot extends CommonObject public function loadStatsReception($socid = 0) { // phpcs:enable - global $db, $conf, $user, $hookmanager, $action; + global $user, $hookmanager, $action; $sql = "SELECT COUNT(DISTINCT recep.fk_soc) as nb_customers, COUNT(DISTINCT recep.rowid) as nb,"; $sql .= " COUNT(cfdi.rowid) as nb_rows, SUM(cfdi.qty) as qty"; @@ -1072,7 +1072,7 @@ class Productlot extends CommonObject public function LibStatut($status, $mode = 0) { // phpcs:enable - global $langs; + //global $langs; //$langs->load('stocks'); @@ -1089,11 +1089,11 @@ class Productlot extends CommonObject */ public function getTooltipContentArray($params) { - global $conf, $langs, $user; + global $langs, $user; $langs->loadLangs(['stocks', 'productbatch']); - $option = $params['option'] ?? ''; + //$option = $params['option'] ?? ''; $datas = []; $datas['picto'] = img_picto('', $this->picto).' <u class="paddingrightonly">'.$langs->trans("Batch").'</u>'; @@ -1124,7 +1124,7 @@ class Productlot extends CommonObject */ public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $maxlen = 24, $morecss = '', $save_lastsearch_value = -1) { - global $langs, $conf, $hookmanager; + global $langs, $hookmanager; $result = ''; $params = [ @@ -1212,6 +1212,8 @@ class Productlot extends CommonObject { global $conf; + $now = dol_now(); + // Initialise parameters $this->id = 0; $this->ref = 'SPECIMEN'; @@ -1220,13 +1222,13 @@ class Productlot extends CommonObject $this->entity = $conf->entity; $this->fk_product = null; $this->batch = ''; - $this->eatby = ''; - $this->sellby = ''; - $this->datec = ''; - $this->tms = ''; + $this->eatby = $now - 100000; + $this->sellby = $now - 100000; + $this->datec = $now - 3600; + $this->tms = $now; $this->fk_user_creat = null; $this->fk_user_modif = null; - $this->import_key = ''; + $this->import_key = '123456'; } /** @@ -1241,7 +1243,7 @@ class Productlot extends CommonObject */ public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0) { - global $conf, $user, $langs; + global $langs; $langs->loadLangs(array('stocks', 'productbatch', "products")); $outputlangs->loadLangs(array('stocks', 'productbatch', "products")); @@ -1261,4 +1263,25 @@ class Productlot extends CommonObject return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref); } + + /** + * Return validation test result for a field + * + * @param array $fields Array of properties of field to show + * @param string $fieldKey Key of attribute + * @param string $fieldValue value of attribute + * @return bool Return false if fail, true on success, set $this->error for error message + */ + public function validateField($fields, $fieldKey, $fieldValue) + { + // Add your own validation rules here. + if ($fieldKey == 'batch') { + if (preg_match('/\s/', $fieldValue)) { + $this->error = 'ErrorABatchShouldNotContainsSpaces'; + return false; + } + } + + return parent::validateField($fields, $fieldKey, $fieldValue); + } } diff --git a/htdocs/product/stock/info.php b/htdocs/product/stock/info.php index fd3c8e2e9c4..c49d7f2f208 100644 --- a/htdocs/product/stock/info.php +++ b/htdocs/product/stock/info.php @@ -36,7 +36,7 @@ $ref = GETPOST('ref', 'alpha'); // Security check //$result=restrictedArea($user,'stock', $id, 'entrepot&stock'); $result = restrictedArea($user, 'stock'); -$usercancreate = $user->rights->stock->creer; +$usercancreate = $user->hasRight('stock', 'creer'); /* * View diff --git a/htdocs/product/stock/list.php b/htdocs/product/stock/list.php index 3f9ca9d6cce..712e44f3a18 100644 --- a/htdocs/product/stock/list.php +++ b/htdocs/product/stock/list.php @@ -135,9 +135,9 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); -$permissiontoread = $user->rights->stock->lire; -$permissiontodelete = $user->rights->stock->supprimer; -$permissiontoadd = $user->rights->stock->creer; +$permissiontoread = $user->hasRight('stock', 'lire'); +$permissiontodelete = $user->hasRight('stock', 'supprimer'); +$permissiontoadd = $user->hasRight('stock', 'creer'); // Security check $result = restrictedArea($user, 'stock'); @@ -927,8 +927,8 @@ if (in_array('builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords $urlsource .= str_replace('&', '&', $param); $filedir = $diroutputmassaction; - $genallowed = $user->rights->stock->lire; - $delallowed = $user->rights->stock->creer; + $genallowed = $user->hasRight('stock', 'lire'); + $delallowed = $user->hasRight('stock', 'creer'); print $formfile->showdocuments('massfilesarea_stock', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty); } diff --git a/htdocs/product/stock/movement_card.php b/htdocs/product/stock/movement_card.php index 11c3dc31649..974ba22666c 100644 --- a/htdocs/product/stock/movement_card.php +++ b/htdocs/product/stock/movement_card.php @@ -122,9 +122,9 @@ $arrayfields = array( //'m.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500) ); -$usercanread = (($user->rights->stock->mouvement->lire)); -$usercancreate = (($user->rights->stock->mouvement->creer)); -$usercandelete = (($user->rights->stock->mouvement->supprimer)); +$usercanread = (($user->hasRight('stock', 'mouvement', 'lire'))); +$usercancreate = (($user->hasRight('stock', 'mouvement', 'creer'))); +$usercandelete = (($user->hasRight('stock', 'mouvement', 'supprimer'))); @@ -400,15 +400,15 @@ if ($action == "transfert_stock" && !$cancel) { // The builddoc action for object of a movement must be on the movement card // Actions to build doc $upload_dir = $conf->stock->dir_output."movement/"; -$permissiontoadd = $user->rights->stock->creer; +$permissiontoadd = $user->hasRight('stock', 'creer'); include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; if (empty($reshook) && $action != 'remove_file') { $objectclass = 'MouvementStock'; $objectlabel = 'Movements'; - $permissiontoread = $user->rights->stock->lire; - $permissiontodelete = $user->rights->stock->supprimer; + $permissiontoread = $user->hasRight('stock', 'lire'); + $permissiontodelete = $user->hasRight('stock', 'supprimer'); $uploaddir = $conf->stock->dir_output."/movement/"; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } @@ -1199,8 +1199,8 @@ if ($action != 'create' && $action != 'edit' && $action != 'delete' && $id > 0) $genallowed = $usercanread; $delallowed = $usercancreate; - $genallowed = $user->rights->stock->lire; - $delallowed = $user->rights->stock->creer; + $genallowed = $user->hasRight('stock', 'lire'); + $delallowed = $user->hasRight('stock', 'creer'); print $formfile->showdocuments($modulepart, $objectref, $filedir, $urlsource, $genallowed, $delallowed, '', 0, 0, 0, 28, 0, '', 0, '', $object->default_lang, '', $object); $somethingshown = $formfile->numoffiles; diff --git a/htdocs/product/stock/movement_list.php b/htdocs/product/stock/movement_list.php index d8cb47f17fe..1e07e1970a4 100644 --- a/htdocs/product/stock/movement_list.php +++ b/htdocs/product/stock/movement_list.php @@ -173,13 +173,13 @@ if (!$user->hasRight('stock', 'mouvement', 'lire')) { $uploaddir = $conf->stock->dir_output.'/movements'; -$permissiontoread = $user->rights->stock->mouvement->lire; -$permissiontoadd = $user->rights->stock->mouvement->creer; -$permissiontodelete = $user->rights->stock->mouvement->creer; // There is no deletion permission for stock movement as we should never delete +$permissiontoread = $user->hasRight('stock', 'mouvement', 'lire'); +$permissiontoadd = $user->hasRight('stock', 'mouvement', 'creer'); +$permissiontodelete = $user->hasRight('stock', 'mouvement', 'creer'); // There is no deletion permission for stock movement as we should never delete -$usercanread = $user->rights->stock->mouvement->lire; -$usercancreate = $user->rights->stock->mouvement->creer; -$usercandelete = $user->rights->stock->mouvement->creer; +$usercanread = $user->hasRight('stock', 'mouvement', 'lire'); +$usercancreate = $user->hasRight('stock', 'mouvement', 'creer'); +$usercandelete = $user->hasRight('stock', 'mouvement', 'creer'); $error = 0; diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 690d1f68e01..442fa454d95 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -115,8 +115,8 @@ $hookmanager->initHooks(array('stockproductcard', 'globalcard')); $error = 0; -$usercanread = (($object->type == Product::TYPE_PRODUCT && $user->rights->produit->lire) || ($object->type == Product::TYPE_SERVICE && $user->hasRight('service', 'lire'))); -$usercancreate = (($object->type == Product::TYPE_PRODUCT && $user->rights->produit->creer) || ($object->type == Product::TYPE_SERVICE && $user->hasRight('service', 'creer'))); +$usercanread = (($object->type == Product::TYPE_PRODUCT && $user->hasRight('produit', 'lire')) || ($object->type == Product::TYPE_SERVICE && $user->hasRight('service', 'lire'))); +$usercancreate = (($object->type == Product::TYPE_PRODUCT && $user->hasRight('produit', 'creer')) || ($object->type == Product::TYPE_SERVICE && $user->hasRight('service', 'creer'))); $usercancreadprice = getDolGlobalString('MAIN_USE_ADVANCED_PERMS') ? $user->hasRight('product', 'product_advance', 'read_prices') : $user->hasRight('product', 'lire'); if ($object->isService()) { diff --git a/htdocs/product/stock/productlot_document.php b/htdocs/product/stock/productlot_document.php index 9c04f0e0447..8cc4343ea63 100644 --- a/htdocs/product/stock/productlot_document.php +++ b/htdocs/product/stock/productlot_document.php @@ -109,7 +109,7 @@ if (empty($upload_dir)) { $permissiontoread = $usercanread; $permissiontoadd = $usercancreate; -$permtoedit = $user->rights->produit->creer; +$permtoedit = $user->hasRight('produit', 'creer'); //$permissiontodelete = $usercandelete; // Security check diff --git a/htdocs/product/stock/productlot_list.php b/htdocs/product/stock/productlot_list.php index 5d29e2bcd5b..c5734003b85 100644 --- a/htdocs/product/stock/productlot_list.php +++ b/htdocs/product/stock/productlot_list.php @@ -127,9 +127,9 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); -$usercanread = $user->rights->produit->lire; -$usercancreate = $user->rights->produit->creer; -$usercandelete = $user->rights->produit->supprimer; +$usercanread = $user->hasRight('produit', 'lire'); +$usercancreate = $user->hasRight('produit', 'creer'); +$usercandelete = $user->hasRight('produit', 'supprimer'); $upload_dir = $conf->productbatch->multidir_output[$conf->entity]; diff --git a/htdocs/product/stock/productlot_note.php b/htdocs/product/stock/productlot_note.php index e0e274f05bd..ee5c23ad162 100644 --- a/htdocs/product/stock/productlot_note.php +++ b/htdocs/product/stock/productlot_note.php @@ -50,7 +50,7 @@ if ($id > 0 || !empty($ref)) { $upload_dir = $conf->productlot->multidir_output[!empty($object->entity) ? $object->entity : $conf->entity]."/".$object->id; } -$permissionnote = $user->rights->produit->lire; // Used by the include of actions_setnotes.inc.php +$permissionnote = $user->hasRight('produit', 'lire'); // Used by the include of actions_setnotes.inc.php // Security check (enable the most restrictive one) //if ($user->socid > 0) accessforbidden(); diff --git a/htdocs/product/stock/stocktransfer/stocktransfer_agenda.php b/htdocs/product/stock/stocktransfer/stocktransfer_agenda.php index 4069721ba36..ada61f4f791 100644 --- a/htdocs/product/stock/stocktransfer/stocktransfer_agenda.php +++ b/htdocs/product/stock/stocktransfer/stocktransfer_agenda.php @@ -88,7 +88,7 @@ if ($id > 0 || !empty($ref)) { //if ($user->socid > 0) $socid = $user->socid; $result = restrictedArea($user, 'stocktransfer', $object->id, '', 'stocktransfer'); -$permissiontoadd = $user->rights->stocktransfer->stocktransfer->write; // Used by the include of actions_addupdatedelete.inc.php +$permissiontoadd = $user->hasRight('stocktransfer', 'stocktransfer', 'write'); // Used by the include of actions_addupdatedelete.inc.php /* diff --git a/htdocs/product/stock/stocktransfer/stocktransfer_card.php b/htdocs/product/stock/stocktransfer/stocktransfer_card.php index 5e66bba6ed2..7a3779036e5 100644 --- a/htdocs/product/stock/stocktransfer/stocktransfer_card.php +++ b/htdocs/product/stock/stocktransfer/stocktransfer_card.php @@ -87,11 +87,11 @@ if (empty($action) && empty($id) && empty($ref)) { include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. -$permissiontoread = $user->rights->stocktransfer->stocktransfer->read; -$permissiontoadd = $user->rights->stocktransfer->stocktransfer->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php -$permissionnote = $user->rights->stocktransfer->stocktransfer->write; // Used by the include of actions_setnotes.inc.php +$permissiontoread = $user->hasRight('stocktransfer', 'stocktransfer', 'read'); +$permissiontoadd = $user->hasRight('stocktransfer', 'stocktransfer', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php +$permissionnote = $user->hasRight('stocktransfer', 'stocktransfer', 'write'); // Used by the include of actions_setnotes.inc.php $permissiontodelete = $user->rights->stocktransfer->stocktransfer->delete || ($permissiontoadd && isset($object->status) && $object->status < $object::STATUS_TRANSFERED); -$permissiondellink = $user->rights->stocktransfer->stocktransfer->write; // Used by the include of actions_dellink.inc.php +$permissiondellink = $user->hasRight('stocktransfer', 'stocktransfer', 'write'); // Used by the include of actions_dellink.inc.php $upload_dir = $conf->stocktransfer->multidir_output[isset($object->entity) ? $object->entity : 1]; // Security check - Protection if external user diff --git a/htdocs/product/stock/stocktransfer/stocktransfer_contact.php b/htdocs/product/stock/stocktransfer/stocktransfer_contact.php index 1da1be0ca9c..95fae85acb2 100644 --- a/htdocs/product/stock/stocktransfer/stocktransfer_contact.php +++ b/htdocs/product/stock/stocktransfer/stocktransfer_contact.php @@ -159,7 +159,7 @@ if ($object->id > 0) { print dol_get_fiche_end(); - $user->rights->stocktransfer->write = $user->rights->stocktransfer->stocktransfer->write; + $user->rights->stocktransfer->write = $user->hasRight('stocktransfer', 'stocktransfer', 'write'); // Contacts lines (modules that overwrite templates must declare this into descriptor) $dirtpls = array_merge($conf->modules_parts['tpl'], array('/core/tpl')); foreach ($dirtpls as $reldir) { diff --git a/htdocs/product/stock/stocktransfer/stocktransfer_document.php b/htdocs/product/stock/stocktransfer/stocktransfer_document.php index 3ed8d1280ce..72b5352f740 100644 --- a/htdocs/product/stock/stocktransfer/stocktransfer_document.php +++ b/htdocs/product/stock/stocktransfer/stocktransfer_document.php @@ -80,7 +80,7 @@ if ($id > 0 || !empty($ref)) { //if ($user->socid > 0) $socid = $user->socid; //$result = restrictedArea($user, 'stocktransfer', $object->id); -$permissiontoadd = $user->rights->stocktransfer->stocktransfer->write; // Used by the include of actions_addupdatedelete.inc.php +$permissiontoadd = $user->hasRight('stocktransfer', 'stocktransfer', 'write'); // Used by the include of actions_addupdatedelete.inc.php @@ -182,10 +182,6 @@ if ($object->id) { print dol_get_fiche_end(); $modulepart = 'stocktransfer'; - //$permission = $user->rights->stocktransfer->stocktransfer->write; - $permission = 1; - //$permtoedit = $user->rights->stocktransfer->stocktransfer->write; - $permtoedit = 1; $param = '&id='.$object->id; //$relativepathwithnofile='stocktransfer/' . dol_sanitizeFileName($object->id).'/'; diff --git a/htdocs/product/stock/stocktransfer/stocktransfer_note.php b/htdocs/product/stock/stocktransfer/stocktransfer_note.php index d3ca1b2bbbc..cef7273128d 100644 --- a/htdocs/product/stock/stocktransfer/stocktransfer_note.php +++ b/htdocs/product/stock/stocktransfer/stocktransfer_note.php @@ -56,8 +56,8 @@ if ($id > 0 || !empty($ref)) { $upload_dir = $conf->stocktransfer->multidir_output[$object->entity]."/".$object->id; } -$permissionnote = $user->rights->stocktransfer->stocktransfer->write; // Used by the include of actions_setnotes.inc.php -$permissiontoadd = $user->rights->stocktransfer->stocktransfer->write; // Used by the include of actions_addupdatedelete.inc.php +$permissionnote = $user->hasRight('stocktransfer', 'stocktransfer', 'write'); // Used by the include of actions_setnotes.inc.php +$permissiontoadd = $user->hasRight('stocktransfer', 'stocktransfer', 'write'); // Used by the include of actions_addupdatedelete.inc.php diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 74ab3a085de..50b82ad259d 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -404,6 +404,42 @@ if (empty($reshook)) { } } + if ($action == 'set_opp_status' && $user->hasRight('projet', 'creer')) { + $error = 0; + if (GETPOSTISSET('opp_status')) { + $object->opp_status = $opp_status; + } + if (GETPOSTISSET('opp_percent')) { + $object->opp_percent = $opp_percent; + } + + if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES')) { + if ($object->opp_amount && ($object->opp_status <= 0)) { + $error++; + setEventMessages($langs->trans("ErrorOppStatusRequiredIfAmount"), null, 'errors'); + } + } + + if (!$error) { + $result = $object->update($user); + if ($result < 0) { + $error++; + if ($result == -4) { + setEventMessages($langs->trans("ErrorRefAlreadyExists"), null, 'errors'); + } else { + setEventMessages($object->error, $object->errors, 'errors'); + } + } + } + + if ($error) { + $db->rollback(); + $action = 'edit'; + } else { + $db->commit(); + } + } + // Build doc if ($action == 'builddoc' && $permissiontoadd) { // Save last template used to generate document @@ -1347,18 +1383,16 @@ if ($action == 'create' && $user->hasRight('projet', 'creer')) { if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES') && !empty($object->usage_opportunity)) { // Opportunity status - print '<tr><td>'.$langs->trans("OpportunityStatus").'</td><td>'; - $code = dol_getIdFromCode($db, $object->opp_status, 'c_lead_status', 'rowid', 'code'); - if ($code) { - print $langs->trans("OppStatus".$code); + print '<tr><td>'.$langs->trans("OpportunityStatus"); + if ($action != 'edit_opp_status' && $user->hasRight('projet', 'creer')) { + print '<a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=edit_opp_status&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'</a>'; } - - // Opportunity percent - print ' <span title="'.$langs->trans("OpportunityProbability").'"> / '; - if (strcmp($object->opp_percent, '')) { - print price($object->opp_percent, 0, $langs, 1, 0).' %'; - } - print '</span></td></tr>'; + print '</td><td>'; + $html_name_status = ($action == 'edit_opp_status') ? 'opp_status' : 'none'; + $html_name_percent = ($action == 'edit_opp_status') ? 'opp_percent' : 'none'; + $percent_value = (GETPOSTISSET('opp_percent') ? GETPOST('opp_percent') : (strcmp($object->opp_percent, '') ? vatrate($object->opp_percent) : '')); + $formproject->formOpportunityStatus($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->opp_status, $percent_value, $html_name_status, $html_name_percent); + print '</td></tr>'; // Opportunity Amount print '<tr><td>'.$langs->trans("OpportunityAmount").'</td><td>'; diff --git a/htdocs/projet/class/api_projects.class.php b/htdocs/projet/class/api_projects.class.php index 4c1dc29350d..896c1219653 100644 --- a/htdocs/projet/class/api_projects.class.php +++ b/htdocs/projet/class/api_projects.class.php @@ -71,7 +71,7 @@ class Projects extends DolibarrApi */ public function get($id) { - if (!DolibarrApiAccess::$user->rights->projet->lire) { + if (!DolibarrApiAccess::$user->hasRight('projet', 'lire')) { throw new RestException(403); } @@ -107,7 +107,7 @@ class Projects extends DolibarrApi */ public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $category = 0, $sqlfilters = '', $properties = '') { - if (!DolibarrApiAccess::$user->rights->projet->lire) { + if (!DolibarrApiAccess::$user->hasRight('projet', 'lire')) { throw new RestException(403); } @@ -118,7 +118,7 @@ class Projects extends DolibarrApi // If the internal user must only see his customers, force searching by him $search_sale = 0; - if (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) { + if (!DolibarrApiAccess::$user->hasRight('societe', 'client', 'voir') && !$socids) { $search_sale = DolibarrApiAccess::$user->id; } @@ -193,7 +193,7 @@ class Projects extends DolibarrApi */ public function post($request_data = null) { - if (!DolibarrApiAccess::$user->rights->projet->creer) { + if (!DolibarrApiAccess::$user->hasRight('projet', 'creer')) { throw new RestException(401, "Insuffisant rights"); } // Check mandatory fields @@ -234,7 +234,7 @@ class Projects extends DolibarrApi */ public function getLines($id, $includetimespent = 0) { - if (!DolibarrApiAccess::$user->rights->projet->lire) { + if (!DolibarrApiAccess::$user->hasRight('projet', 'lire')) { throw new RestException(403); } @@ -274,7 +274,7 @@ class Projects extends DolibarrApi { global $db; - if (!DolibarrApiAccess::$user->rights->projet->lire) { + if (!DolibarrApiAccess::$user->hasRight('projet', 'lire')) { throw new RestException(403); } @@ -317,7 +317,7 @@ class Projects extends DolibarrApi /* public function postLine($id, $request_data = null) { - if(! DolibarrApiAccess::$user->rights->projet->creer) { + if(! DolibarrApiAccess::$user->hasRight('projet', 'creer')) { throw new RestException(403); } @@ -384,7 +384,7 @@ class Projects extends DolibarrApi /* public function putLine($id, $lineid, $request_data = null) { - if(! DolibarrApiAccess::$user->rights->projet->creer) { + if(! DolibarrApiAccess::$user->hasRight('projet', 'creer')) { throw new RestException(403); } @@ -445,7 +445,7 @@ class Projects extends DolibarrApi */ public function put($id, $request_data = null) { - if (!DolibarrApiAccess::$user->rights->projet->creer) { + if (!DolibarrApiAccess::$user->hasRight('projet', 'creer')) { throw new RestException(403); } @@ -486,7 +486,7 @@ class Projects extends DolibarrApi */ public function delete($id) { - if (!DolibarrApiAccess::$user->rights->projet->supprimer) { + if (!DolibarrApiAccess::$user->hasRight('projet', 'supprimer')) { throw new RestException(403); } $result = $this->project->fetch($id); @@ -530,7 +530,7 @@ class Projects extends DolibarrApi */ public function validate($id, $notrigger = 0) { - if (!DolibarrApiAccess::$user->rights->projet->creer) { + if (!DolibarrApiAccess::$user->hasRight('projet', 'creer')) { throw new RestException(403); } $result = $this->project->fetch($id); diff --git a/htdocs/projet/class/api_tasks.class.php b/htdocs/projet/class/api_tasks.class.php index 43f5973c6f8..28304406505 100644 --- a/htdocs/projet/class/api_tasks.class.php +++ b/htdocs/projet/class/api_tasks.class.php @@ -67,7 +67,7 @@ class Tasks extends DolibarrApi */ public function get($id, $includetimespent = 0) { - if (!DolibarrApiAccess::$user->rights->projet->lire) { + if (!DolibarrApiAccess::$user->hasRight('projet', 'lire')) { throw new RestException(403); } @@ -109,7 +109,7 @@ class Tasks extends DolibarrApi { global $db, $conf; - if (!DolibarrApiAccess::$user->rights->projet->lire) { + if (!DolibarrApiAccess::$user->hasRight('projet', 'lire')) { throw new RestException(403); } @@ -120,7 +120,7 @@ class Tasks extends DolibarrApi // If the internal user must only see his customers, force searching by him $search_sale = 0; - if (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) { + if (!DolibarrApiAccess::$user->hasRight('societe', 'client', 'voir') && !$socids) { $search_sale = DolibarrApiAccess::$user->id; } @@ -189,7 +189,7 @@ class Tasks extends DolibarrApi */ public function post($request_data = null) { - if (!DolibarrApiAccess::$user->rights->projet->creer) { + if (!DolibarrApiAccess::$user->hasRight('projet', 'creer')) { throw new RestException(401, "Insuffisant rights"); } // Check mandatory fields @@ -229,7 +229,7 @@ class Tasks extends DolibarrApi /* public function getLines($id, $includetimespent=0) { - if(! DolibarrApiAccess::$user->rights->projet->lire) { + if(! DolibarrApiAccess::$user->hasRight('projet', 'lire')) { throw new RestException(403); } @@ -274,7 +274,7 @@ class Tasks extends DolibarrApi { global $db; - if (!DolibarrApiAccess::$user->rights->projet->lire) { + if (!DolibarrApiAccess::$user->hasRight('projet', 'lire')) { throw new RestException(403); } @@ -315,7 +315,7 @@ class Tasks extends DolibarrApi /* public function postLine($id, $request_data = null) { - if(! DolibarrApiAccess::$user->rights->projet->creer) { + if(! DolibarrApiAccess::$user->hasRight('projet', 'creer')) { throw new RestException(403); } @@ -382,7 +382,7 @@ class Tasks extends DolibarrApi /* public function putLine($id, $lineid, $request_data = null) { - if(! DolibarrApiAccess::$user->rights->projet->creer) { + if(! DolibarrApiAccess::$user->hasRight('projet', 'creer')) { throw new RestException(403); } @@ -442,7 +442,7 @@ class Tasks extends DolibarrApi */ public function put($id, $request_data = null) { - if (!DolibarrApiAccess::$user->rights->projet->creer) { + if (!DolibarrApiAccess::$user->hasRight('projet', 'creer')) { throw new RestException(403); } @@ -483,7 +483,7 @@ class Tasks extends DolibarrApi */ public function delete($id) { - if (!DolibarrApiAccess::$user->rights->projet->supprimer) { + if (!DolibarrApiAccess::$user->hasRight('projet', 'supprimer')) { throw new RestException(403); } $result = $this->task->fetch($id); @@ -526,7 +526,7 @@ class Tasks extends DolibarrApi */ public function addTimeSpent($id, $date, $duration, $user_id = 0, $note = '') { - if (!DolibarrApiAccess::$user->rights->projet->creer) { + if (!DolibarrApiAccess::$user->hasRight('projet', 'creer')) { throw new RestException(403); } $result = $this->task->fetch($id); @@ -585,7 +585,7 @@ class Tasks extends DolibarrApi */ public function putTimeSpent($id, $timespent_id, $date, $duration, $user_id = 0, $note = '') { - if (!DolibarrApiAccess::$user->rights->projet->creer) { + if (!DolibarrApiAccess::$user->hasRight('projet', 'creer')) { throw new RestException(403); } $this->timespentRecordChecks($id, $timespent_id); @@ -630,7 +630,7 @@ class Tasks extends DolibarrApi */ public function deleteTimeSpent($id, $timespent_id) { - if (!DolibarrApiAccess::$user->rights->projet->supprimer) { + if (!DolibarrApiAccess::$user->hasRight('projet', 'supprimer')) { throw new RestException(403); } $this->timespentRecordChecks($id, $timespent_id); diff --git a/htdocs/projet/contact.php b/htdocs/projet/contact.php index 43297b14009..b9926768a95 100644 --- a/htdocs/projet/contact.php +++ b/htdocs/projet/contact.php @@ -165,50 +165,83 @@ if (empty($reshook)) { $contactid = (GETPOST('userid') ? GETPOST('userid', 'int') : GETPOST('contactid', 'int')); $typeid = (GETPOST('typecontact') ? GETPOST('typecontact') : GETPOST('type')); + $groupid = GETPOSTINT('groupid'); + $contactarray = array(); + $errorgroup = 0; + $errorgrouparray = array(); - if (! ($contactid > 0)) { + if ($groupid > 0) { + require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php'; + $usergroup = new UserGroup($db); + $result = $usergroup->fetch($groupid); + if ($result > 0) { + $tmpcontactarray = $usergroup->listUsersForGroup(); + if ($contactarray <= 0) { + $error++; + } else { + foreach ($tmpcontactarray as $tmpuser) { + $contactarray[] = $tmpuser->id; + } + } + } else { + $error++; + } + } elseif (! ($contactid > 0)) { $error++; $langs->load("errors"); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Contact")), null, 'errors'); + } else { + $contactarray[] = $contactid; } $result = 0; $result = $object->fetch($id); - if (!$error && $result > 0 && $id > 0) { - $result = $object->add_contact($contactid, $typeid, GETPOST("source", 'aZ09')); + foreach ($contactarray as $key => $contactid) { + $result = $object->add_contact($contactid, $typeid, GETPOST("source", 'aZ09')); - if ($result == 0) { - $langs->load("errors"); - setEventMessages($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), null, 'errors'); - } elseif ($result < 0) { - if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') { - $langs->load("errors"); - setEventMessages($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), null, 'errors'); - } else { - setEventMessages($object->error, $object->errors, 'errors'); + if ($result == 0) { + if ($groupid > 0) { + $errorgroup++; + $errorgrouparray[] = $contactid; + } else { + $langs->load("errors"); + setEventMessages($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), null, 'errors'); + } + } elseif ($result < 0) { + if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') { + if ($groupid > 0) { + $errorgroup++; + $errorgrouparray[] = $contactid; + } else { + $langs->load("errors"); + setEventMessages($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), null, 'errors'); + } + } else { + setEventMessages($object->error, $object->errors, 'errors'); + } } - } - $affecttotask=GETPOST('tasksavailable', 'intcomma'); - if (!empty($affecttotask)) { - require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php'; - $task_to_affect = explode(',', $affecttotask); - if (!empty($task_to_affect)) { - foreach ($task_to_affect as $task_id) { - if (GETPOSTISSET('person_'.$task_id) && GETPOST('person_'.$task_id, 'san_alpha')) { - $tasksToAffect = new Task($db); - $result=$tasksToAffect->fetch($task_id); - if ($result < 0) { - setEventMessages($tasksToAffect->error, null, 'errors'); - } else { - $result = $tasksToAffect->add_contact($contactid, GETPOST('person_role_'.$task_id), GETPOST("source", 'aZ09')); + $affecttotask=GETPOST('tasksavailable', 'intcomma'); + if (!empty($affecttotask)) { + require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php'; + $task_to_affect = explode(',', $affecttotask); + if (!empty($task_to_affect)) { + foreach ($task_to_affect as $task_id) { + if (GETPOSTISSET('person_'.$task_id) && GETPOST('person_'.$task_id, 'san_alpha')) { + $tasksToAffect = new Task($db); + $result=$tasksToAffect->fetch($task_id); if ($result < 0) { - if ($tasksToAffect->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') { - $langs->load("errors"); - setEventMessages($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), null, 'errors'); - } else { - setEventMessages($tasksToAffect->error, $tasksToAffect->errors, 'errors'); + setEventMessages($tasksToAffect->error, null, 'errors'); + } else { + $result = $tasksToAffect->add_contact($contactid, GETPOST('person_role_'.$task_id), GETPOST("source", 'aZ09')); + if ($result < 0) { + if ($tasksToAffect->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') { + $langs->load("errors"); + setEventMessages($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), null, 'errors'); + } else { + setEventMessages($tasksToAffect->error, $tasksToAffect->errors, 'errors'); + } } } } @@ -217,6 +250,18 @@ if (empty($reshook)) { } } } + if ($errorgroup > 0) { + $langs->load("errors"); + if ($errorgroup == count($contactarray)) { + setEventMessages($langs->trans("ErrorThisGroupIsAlreadyDefinedAsThisType"), null, 'errors'); + } else { + $tmpuser = new User($db); + foreach ($errorgrouparray as $key => $value) { + $tmpuser->fetch($value); + setEventMessages($langs->trans("ErrorThisContactXIsAlreadyDefinedAsThisType", dolGetFirstLastname($tmpuser->firstname, $tmpuser->lastname)), null, 'errors'); + } + } + } if ($result >= 0) { header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); diff --git a/htdocs/projet/index.php b/htdocs/projet/index.php index 959cc1e84b3..b1759b48a43 100644 --- a/htdocs/projet/index.php +++ b/htdocs/projet/index.php @@ -92,7 +92,7 @@ $projectstatic = new Project($db); $form = new Form($db); $formfile = new FormFile($db); -$projectset = ($mine ? $mine : (empty($user->rights->projet->all->lire) ? 0 : 2)); +$projectset = ($mine ? $mine : (!$user->hasRight('projet', 'all', 'lire') ? 0 : 2)); $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, $projectset, 1); //var_dump($projectsListId); diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index f71b0fbfeb2..17bf7541798 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -695,7 +695,7 @@ if ($id > 0 || !empty($ref)) { $filename = dol_sanitizeFileName($projectstatic->ref)."/".dol_sanitizeFileName($object->ref); $filedir = $conf->project->dir_output."/".dol_sanitizeFileName($projectstatic->ref)."/".dol_sanitizeFileName($object->ref); $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id; - $genallowed = ($user->rights->projet->lire); + $genallowed = ($user->hasRight('projet', 'lire')); $delallowed = ($user->hasRight('projet', 'creer')); print $formfile->showdocuments('project_task', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf); diff --git a/htdocs/public/emailing/mailing-unsubscribe.php b/htdocs/public/emailing/mailing-unsubscribe.php index 06bd5db19f2..7987a082144 100644 --- a/htdocs/public/emailing/mailing-unsubscribe.php +++ b/htdocs/public/emailing/mailing-unsubscribe.php @@ -23,7 +23,7 @@ /** * \file public/emailing/mailing-unsubscribe.php * \ingroup mailing - * \brief Script use to update unsubcribe status of an email + * \brief Script use to update unsubscribe status of an email * https://myserver/public/emailing/mailing-unsubscribe.php?unsuscrib=1&securitykey=securitykey&tag=abcdefghijklmn */ diff --git a/htdocs/public/stripe/ipn.php b/htdocs/public/stripe/ipn.php index 9e62d69cf6d..ca589c68981 100644 --- a/htdocs/public/stripe/ipn.php +++ b/htdocs/public/stripe/ipn.php @@ -467,7 +467,7 @@ if ($event->type == 'payout.created') { } if (!$error && isModEnabled('banque')) { - // Search again the payment to see if it is already linked to a bank payment record (We should always find the payement now we have created before). + // Search again the payment to see if it is already linked to a bank payment record (We should always find the payment that was created before). $ispaymentdone = 0; $sql = "SELECT p.rowid, p.fk_bank FROM llx_paiement as p"; $sql .= " WHERE p.ext_payment_id = '".$db->escape($paiement->ext_payment_id)."'"; diff --git a/htdocs/public/webportal/tpl/menu.tpl.php b/htdocs/public/webportal/tpl/menu.tpl.php index 5496b14b213..bb615c24135 100644 --- a/htdocs/public/webportal/tpl/menu.tpl.php +++ b/htdocs/public/webportal/tpl/menu.tpl.php @@ -92,14 +92,14 @@ $navGroupMenu = array( 'id' => 'administrative', 'rank' => -1, // negative value for undefined, it will be set by the min item rank for this group 'url' => '', - 'name' => $langs->trans('GroupMenuAdministrative'), + 'name' => $langs->trans('WebPortalGroupMenuAdmin'), 'children' => array() ), 'technical' => array( 'id' => 'technical', 'rank' => -1, // negative value for undefined, it will be set by the min item rank for this group 'url' => '', - 'name' => $langs->trans('GroupMenuTechnical'), + 'name' => $langs->trans('WebPortalGroupMenuTechnical'), 'children' => array() ), ); @@ -167,7 +167,7 @@ if (empty($reshook)) { <ul> <li class="brand"> <?php - $brandTitle = !empty($conf->global->WEBPORTAL_TITLE) ? getDolGlobalString('WEBPORTAL_TITLE') : getDolGlobalString('MAIN_INFO_SOCIETE_NOM'); + $brandTitle = getDolGlobalString('WEBPORTAL_TITLE') ? getDolGlobalString('WEBPORTAL_TITLE') : getDolGlobalString('MAIN_INFO_SOCIETE_NOM'); print '<a class="brand__logo-link" href="'.$context->getControllerUrl().'" >'; if (!empty($context->theme->menuLogoUrl)) { print '<img class="brand__logo-img" src="' . dol_escape_htmltag($context->theme->menuLogoUrl) . '" alt="' . dol_escape_htmltag($brandTitle) . '" >'; diff --git a/htdocs/public/webportal/webportal.main.inc.php b/htdocs/public/webportal/webportal.main.inc.php index 667c8f340eb..f72337314c1 100644 --- a/htdocs/public/webportal/webportal.main.inc.php +++ b/htdocs/public/webportal/webportal.main.inc.php @@ -79,7 +79,7 @@ if (!defined('WEBPORTAL_NOREQUIRETRAN') || (!defined('WEBPORTAL_NOLOGIN') && !em if (!is_object($langs)) { // This can occurs when calling page with NOREQUIRETRAN defined, however we need langs for error messages. include_once DOL_DOCUMENT_ROOT . '/core/class/translate.class.php'; $langs = new Translate("", $conf); - $langcode = (GETPOST('lang', 'aZ09', 1) ? GETPOST('lang', 'aZ09', 1) : (empty($logged_user->conf->MAIN_LANG_DEFAULT) ? (empty($conf->global->MAIN_LANG_DEFAULT) ? 'auto' : $conf->global->MAIN_LANG_DEFAULT) : $logged_user->conf->MAIN_LANG_DEFAULT)); + $langcode = (GETPOST('lang', 'aZ09', 1) ? GETPOST('lang', 'aZ09', 1) : (empty($logged_user->conf->MAIN_LANG_DEFAULT) ? (!getDolGlobalString('MAIN_LANG_DEFAULT') ? 'auto' : $conf->global->MAIN_LANG_DEFAULT) : $logged_user->conf->MAIN_LANG_DEFAULT)); if (defined('MAIN_LANG_DEFAULT')) { $langcode = constant('MAIN_LANG_DEFAULT'); } @@ -143,7 +143,7 @@ if (!defined('WEBPORTAL_NOLOGIN') && !empty($context->controllerInstance->access if (empty($webportal_logged_thirdparty_account_id)) { // Set cookie for timeout management - if (!empty($conf->global->MAIN_SESSION_TIMEOUT)) { + if (getDolGlobalString('MAIN_SESSION_TIMEOUT')) { setcookie($sessiontimeout, $conf->global->MAIN_SESSION_TIMEOUT, 0, "/", null, (empty($dolibarr_main_force_https) ? false : true), true); } diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index a4d4c666377..a0df3a17284 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -156,17 +156,17 @@ if (isModEnabled("reception") || $origin == 'reception' || empty($origin)) { } if (isModEnabled("reception")) { - $permissiontoread = $user->rights->reception->lire; - $permissiontoadd = $user->rights->reception->creer; - $permissiondellink = $user->rights->reception->creer; // Used by the include of actions_dellink.inc.php - $permissiontovalidate = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !empty($user->rights->reception->creer)) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !empty($user->rights->reception->reception_advance->validate))); - $permissiontodelete = $user->rights->reception->supprimer; + $permissiontoread = $user->hasRight('reception', 'lire'); + $permissiontoadd = $user->hasRight('reception', 'creer'); + $permissiondellink = $user->hasRight('reception', 'creer'); // Used by the include of actions_dellink.inc.php + $permissiontovalidate = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('reception', 'creer')) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('reception', 'reception_advance', 'validate'))); + $permissiontodelete = $user->hasRight('reception', 'supprimer'); } else { - $permissiontoread = $user->rights->fournisseur->commande->receptionner; - $permissiontoadd = $user->rights->fournisseur->commande->receptionner; - $permissiondellink = $user->rights->fournisseur->commande->receptionner; // Used by the include of actions_dellink.inc.php - $permissiontovalidate = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !empty($user->rights->fournisseur->commande->receptionner)) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !empty($user->rights->fournisseur->commande_advance->check))); - $permissiontodelete = $user->rights->fournisseur->commande->receptionner; + $permissiontoread = $user->hasRight('fournisseur', 'commande', 'receptionner'); + $permissiontoadd = $user->hasRight('fournisseur', 'commande', 'receptionner'); + $permissiondellink = $user->hasRight('fournisseur', 'commande', 'receptionner'); // Used by the include of actions_dellink.inc.php + $permissiontovalidate = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('fournisseur', 'commande', 'receptionner')) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('fournisseur', 'commande_advance', 'check'))); + $permissiontodelete = $user->hasRight('fournisseur', 'commande', 'receptionner'); } @@ -2208,8 +2208,8 @@ if ($action == 'create') { $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id; - $genallowed = $user->rights->reception->lire; - $delallowed = $user->rights->reception->creer; + $genallowed = $user->hasRight('reception', 'lire'); + $delallowed = $user->hasRight('reception', 'creer'); print $formfile->showdocuments('reception', $objectref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang); diff --git a/htdocs/reception/class/api_receptions.class.php b/htdocs/reception/class/api_receptions.class.php index 69e5b77d616..e8a035c4049 100644 --- a/htdocs/reception/class/api_receptions.class.php +++ b/htdocs/reception/class/api_receptions.class.php @@ -63,7 +63,7 @@ class Receptions extends DolibarrApi */ public function get($id) { - if (!DolibarrApiAccess::$user->rights->reception->lire) { + if (!DolibarrApiAccess::$user->hasRight('reception', 'lire')) { throw new RestException(403); } @@ -100,7 +100,7 @@ class Receptions extends DolibarrApi */ public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '', $properties = '') { - if (!DolibarrApiAccess::$user->rights->reception->lire) { + if (!DolibarrApiAccess::$user->hasRight('reception', 'lire')) { throw new RestException(403); } @@ -111,7 +111,7 @@ class Receptions extends DolibarrApi // If the internal user must only see his customers, force searching by him $search_sale = 0; - if (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) { + if (!DolibarrApiAccess::$user->hasRight('societe', 'client', 'voir') && !$socids) { $search_sale = DolibarrApiAccess::$user->id; } @@ -179,7 +179,7 @@ class Receptions extends DolibarrApi */ public function post($request_data = null) { - if (!DolibarrApiAccess::$user->rights->reception->creer) { + if (!DolibarrApiAccess::$user->hasRight('reception', 'creer')) { throw new RestException(401, "Insuffisant rights"); } // Check mandatory fields @@ -221,16 +221,16 @@ class Receptions extends DolibarrApi /* public function getLines($id) { - if(! DolibarrApiAccess::$user->rights->reception->lire) { + if (!DolibarrApiAccess::$user->hasRight('reception', 'lire')) { throw new RestException(403); } $result = $this->reception->fetch($id); - if( ! $result ) { + if (! $result) { throw new RestException(404, 'Reception not found'); } - if( ! DolibarrApi::_checkAccessToResource('reception',$this->reception->id)) { + if (!DolibarrApi::_checkAccessToResource('reception',$this->reception->id)) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } $this->reception->getLinesArray(); @@ -255,16 +255,16 @@ class Receptions extends DolibarrApi /* public function postLine($id, $request_data = null) { - if(! DolibarrApiAccess::$user->rights->reception->creer) { + if (!DolibarrApiAccess::$user->hasRight('reception', 'creer')) { throw new RestException(403); } $result = $this->reception->fetch($id); - if ( ! $result ) { + if (! $result) { throw new RestException(404, 'Reception not found'); } - if( ! DolibarrApi::_checkAccessToResource('reception',$this->reception->id)) { + if (!DolibarrApi::_checkAccessToResource('reception',$this->reception->id)) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } @@ -323,16 +323,16 @@ class Receptions extends DolibarrApi /* public function putLine($id, $lineid, $request_data = null) { - if (! DolibarrApiAccess::$user->rights->reception->creer) { + if (!DolibarrApiAccess::$user->hasRight('reception', 'creer')) { throw new RestException(403); } $result = $this->reception->fetch($id); - if ( ! $result ) { + if (! $result) { throw new RestException(404, 'Reception not found'); } - if( ! DolibarrApi::_checkAccessToResource('reception',$this->reception->id)) { + if (!DolibarrApi::_checkAccessToResource('reception',$this->reception->id)) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } @@ -388,7 +388,7 @@ class Receptions extends DolibarrApi */ public function deleteLine($id, $lineid) { - if (!DolibarrApiAccess::$user->rights->reception->creer) { + if (!DolibarrApiAccess::$user->hasRight('reception', 'creer')) { throw new RestException(403); } @@ -425,7 +425,7 @@ class Receptions extends DolibarrApi */ public function put($id, $request_data = null) { - if (!DolibarrApiAccess::$user->rights->reception->creer) { + if (!DolibarrApiAccess::$user->hasRight('reception', 'creer')) { throw new RestException(403); } @@ -465,7 +465,7 @@ class Receptions extends DolibarrApi */ public function delete($id) { - if (!DolibarrApiAccess::$user->rights->reception->supprimer) { + if (!DolibarrApiAccess::$user->hasRight('reception', 'supprimer')) { throw new RestException(403); } $result = $this->reception->fetch($id); @@ -510,7 +510,7 @@ class Receptions extends DolibarrApi */ public function validate($id, $notrigger = 0) { - if (!DolibarrApiAccess::$user->rights->reception->creer) { + if (!DolibarrApiAccess::$user->hasRight('reception', 'creer')) { throw new RestException(403); } $result = $this->reception->fetch($id); @@ -556,19 +556,19 @@ class Receptions extends DolibarrApi public function setinvoiced($id) { - if(! DolibarrApiAccess::$user->rights->reception->creer) { + if (!DolibarrApiAccess::$user->hasRight('reception', 'creer')) { throw new RestException(403); } - if(empty($id)) { + if (empty($id)) { throw new RestException(400, 'Reception ID is mandatory'); } $result = $this->reception->fetch($id); - if( ! $result ) { + if (!$result) { throw new RestException(404, 'Reception not found'); } $result = $this->reception->classifyBilled(DolibarrApiAccess::$user); - if( $result < 0) { + if ($result < 0) { throw new RestException(400, $this->reception->error); } return $result; @@ -595,19 +595,19 @@ class Receptions extends DolibarrApi require_once DOL_DOCUMENT_ROOT . '/commande/class/commande.class.php'; - if(! DolibarrApiAccess::$user->rights->reception->lire) { + if (!DolibarrApiAccess::$user->hasRight('reception', 'lire')) { throw new RestException(403); } - if(! DolibarrApiAccess::$user->rights->reception->creer) { + if (!DolibarrApiAccess::$user->hasRight('reception', 'creer')) { throw new RestException(403); } - if(empty($proposalid)) { + if (empty($proposalid)) { throw new RestException(400, 'Order ID is mandatory'); } $order = new Commande($this->db); $result = $order->fetch($proposalid); - if( ! $result ) { + if (!$result) { throw new RestException(404, 'Order not found'); } @@ -632,7 +632,7 @@ class Receptions extends DolibarrApi */ public function close($id, $notrigger = 0) { - if (!DolibarrApiAccess::$user->rights->reception->creer) { + if (!DolibarrApiAccess::$user->hasRight('reception', 'creer')) { throw new RestException(403); } diff --git a/htdocs/reception/contact.php b/htdocs/reception/contact.php index 7bd468463bb..c0f2fd18685 100644 --- a/htdocs/reception/contact.php +++ b/htdocs/reception/contact.php @@ -80,17 +80,17 @@ if ($origin == 'reception') { } if (isModEnabled("reception")) { - $permissiontoread = $user->rights->reception->lire; - $permissiontoadd = $user->rights->reception->creer; - $permissiondellink = $user->rights->reception->creer; // Used by the include of actions_dellink.inc.php - $permissiontovalidate = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !empty($user->rights->reception->creer)) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !empty($user->rights->reception->reception_advance->validate))); - $permissiontodelete = $user->rights->reception->supprimer; + $permissiontoread = $user->hasRight('reception', 'lire'); + $permissiontoadd = $user->hasRight('reception', 'creer'); + $permissiondellink = $user->hasRight('reception', 'creer'); // Used by the include of actions_dellink.inc.php + $permissiontovalidate = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('reception', 'creer')) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('reception', 'reception_advance', 'validate'))); + $permissiontodelete = $user->hasRight('reception', 'supprimer'); } else { - $permissiontoread = $user->rights->fournisseur->commande->receptionner; - $permissiontoadd = $user->rights->fournisseur->commande->receptionner; - $permissiondellink = $user->rights->fournisseur->commande->receptionner; // Used by the include of actions_dellink.inc.php - $permissiontovalidate = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !empty($user->rights->fournisseur->commande->receptionner)) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !empty($user->rights->fournisseur->commande_advance->check))); - $permissiontodelete = $user->rights->fournisseur->commande->receptionner; + $permissiontoread = $user->hasRight('fournisseur', 'commande', 'receptionner'); + $permissiontoadd = $user->hasRight('fournisseur', 'commande', 'receptionner'); + $permissiondellink = $user->hasRight('fournisseur', 'commande', 'receptionner'); // Used by the include of actions_dellink.inc.php + $permissiontovalidate = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('fournisseur', 'commande', 'receptionner')) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('fournisseur', 'commande_advance', 'check'))); + $permissiontodelete = $user->hasRight('fournisseur', 'commande', 'receptionner'); } diff --git a/htdocs/reception/dispatch.php b/htdocs/reception/dispatch.php index 2e895150463..aa3bd9991fc 100644 --- a/htdocs/reception/dispatch.php +++ b/htdocs/reception/dispatch.php @@ -98,11 +98,11 @@ if ($id > 0 || !empty($ref)) { } if (empty($conf->reception->enabled)) { - $permissiontoreceive = $user->rights->fournisseur->commande->receptionner; - $permissiontocontrol = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !empty($user->rights->fournisseur->commande->receptionner)) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !empty($user->rights->fournisseur->commande_advance->check))); + $permissiontoreceive = $user->hasRight('fournisseur', 'commande', 'receptionner'); + $permissiontocontrol = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('fournisseur', 'commande', 'receptionner')) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('fournisseur', 'commande_advance', 'check'))); } else { - $permissiontoreceive = $user->rights->reception->creer; - $permissiontocontrol = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !empty($user->rights->reception->creer)) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !empty($user->rights->reception->reception_advance->validate))); + $permissiontoreceive = $user->hasRight('reception', 'creer'); + $permissiontocontrol = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('reception', 'creer')) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('reception', 'reception_advance', 'validate'))); } // $id is id of a reception @@ -205,7 +205,7 @@ if ($action == 'updatelines' && $permissiontoreceive) { $error++; } - // If module stock is enabled and the stock decrease is done on edtion of this page + // If module stock is enabled and the stock decrease is done on edition of this page /* if (!$error && GETPOST($ent, 'int') > 0 && isModEnabled('stock') && !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER)) { $mouv = new MouvementStock($db); diff --git a/htdocs/reception/document.php b/htdocs/reception/document.php index b5e4eafc0c6..30bb01e2d76 100644 --- a/htdocs/reception/document.php +++ b/htdocs/reception/document.php @@ -97,17 +97,17 @@ if ($user->socid > 0) { $result = restrictedArea($user, 'reception', $object->id, ''); if (isModEnabled("reception")) { - $permissiontoread = $user->rights->reception->lire; - $permissiontoadd = $user->rights->reception->creer; - $permissiondellink = $user->rights->reception->creer; // Used by the include of actions_dellink.inc.php - $permissiontovalidate = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !empty($user->rights->reception->creer)) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !empty($user->rights->reception->reception_advance->validate))); - $permissiontodelete = $user->rights->reception->supprimer; + $permissiontoread = $user->hasRight('reception', 'lire'); + $permissiontoadd = $user->hasRight('reception', 'creer'); + $permissiondellink = $user->hasRight('reception', 'creer'); // Used by the include of actions_dellink.inc.php + $permissiontovalidate = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('reception', 'creer')) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('reception', 'reception_advance', 'validate'))); + $permissiontodelete = $user->hasRight('reception', 'supprimer'); } else { - $permissiontoread = $user->rights->fournisseur->commande->receptionner; - $permissiontoadd = $user->rights->fournisseur->commande->receptionner; - $permissiondellink = $user->rights->fournisseur->commande->receptionner; // Used by the include of actions_dellink.inc.php - $permissiontovalidate = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !empty($user->rights->fournisseur->commande->receptionner)) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !empty($user->rights->fournisseur->commande_advance->check))); - $permissiontodelete = $user->rights->fournisseur->commande->receptionner; + $permissiontoread = $user->hasRight('fournisseur', 'commande', 'receptionner'); + $permissiontoadd = $user->hasRight('fournisseur', 'commande', 'receptionner'); + $permissiondellink = $user->hasRight('fournisseur', 'commande', 'receptionner'); // Used by the include of actions_dellink.inc.php + $permissiontovalidate = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('fournisseur', 'commande', 'receptionner')) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('fournisseur', 'commande_advance', 'check'))); + $permissiontodelete = $user->hasRight('fournisseur', 'commande', 'receptionner'); } @@ -198,8 +198,8 @@ if ($id > 0 || !empty($ref)) { print dol_get_fiche_end(); $modulepart = 'reception'; - $permissiontoadd = $user->rights->reception->creer; - $permtoedit = $user->rights->reception->creer; + $permissiontoadd = $user->hasRight('reception', 'creer'); + $permtoedit = $user->hasRight('reception', 'creer'); $param = '&id='.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } else { diff --git a/htdocs/reception/list.php b/htdocs/reception/list.php index ef28514f1fd..b89e8e46797 100644 --- a/htdocs/reception/list.php +++ b/htdocs/reception/list.php @@ -207,9 +207,9 @@ if (empty($reshook)) { // Mass actions $objectclass = 'Reception'; $objectlabel = 'Receptions'; - $permissiontoread = $user->rights->reception->lire; - $permissiontoadd = $user->rights->reception->creer; - $permissiontodelete = $user->rights->reception->supprimer; + $permissiontoread = $user->hasRight('reception', 'lire'); + $permissiontoadd = $user->hasRight('reception', 'creer'); + $permissiontodelete = $user->hasRight('reception', 'supprimer'); $uploaddir = $conf->reception->multidir_output[$conf->entity]; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; diff --git a/htdocs/reception/note.php b/htdocs/reception/note.php index 2d9ae567c02..304f122ce8e 100644 --- a/htdocs/reception/note.php +++ b/htdocs/reception/note.php @@ -69,19 +69,19 @@ if ($user->socid > 0) { } if (isModEnabled("reception")) { - $permissiontoread = $user->rights->reception->lire; - $permissiontoadd = $user->rights->reception->creer; - $permissiondellink = $user->rights->reception->creer; // Used by the include of actions_dellink.inc.php - $permissiontovalidate = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !empty($user->rights->reception->creer)) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !empty($user->rights->reception->reception_advance->validate))); - $permissiontodelete = $user->rights->reception->supprimer; + $permissiontoread = $user->hasRight('reception', 'lire'); + $permissiontoadd = $user->hasRight('reception', 'creer'); + $permissiondellink = $user->hasRight('reception', 'creer'); // Used by the include of actions_dellink.inc.php + $permissiontovalidate = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('reception', 'creer')) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('reception', 'reception_advance', 'validate'))); + $permissiontodelete = $user->hasRight('reception', 'supprimer'); } else { - $permissiontoread = $user->rights->fournisseur->commande->receptionner; - $permissiontoadd = $user->rights->fournisseur->commande->receptionner; - $permissiondellink = $user->rights->fournisseur->commande->receptionner; // Used by the include of actions_dellink.inc.php - $permissiontovalidate = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !empty($user->rights->fournisseur->commande->receptionner)) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !empty($user->rights->fournisseur->commande_advance->check))); - $permissiontodelete = $user->rights->fournisseur->commande->receptionner; + $permissiontoread = $user->hasRight('fournisseur', 'commande', 'receptionner'); + $permissiontoadd = $user->hasRight('fournisseur', 'commande', 'receptionner'); + $permissiondellink = $user->hasRight('fournisseur', 'commande', 'receptionner'); // Used by the include of actions_dellink.inc.php + $permissiontovalidate = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('fournisseur', 'commande', 'receptionner')) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('fournisseur', 'commande_advance', 'check'))); + $permissiontodelete = $user->hasRight('fournisseur', 'commande', 'receptionner'); } -$permissionnote = $user->rights->reception->creer; // Used by the include of actions_setnotes.inc.php +$permissionnote = $user->hasRight('reception', 'creer'); // Used by the include of actions_setnotes.inc.php // TODO Test on reception module on only if ($origin == 'reception') { diff --git a/htdocs/recruitment/class/api_recruitments.class.php b/htdocs/recruitment/class/api_recruitments.class.php index 53245b17ef8..030c9c81e69 100644 --- a/htdocs/recruitment/class/api_recruitments.class.php +++ b/htdocs/recruitment/class/api_recruitments.class.php @@ -156,7 +156,7 @@ class Recruitments extends DolibarrApi // If the internal user must only see his customers, force searching by him $search_sale = 0; - if ($restrictonsocid && !DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) { + if ($restrictonsocid && !DolibarrApiAccess::$user->hasRight('societe', 'client', 'voir') && !$socid) { $search_sale = DolibarrApiAccess::$user->id; } @@ -248,7 +248,7 @@ class Recruitments extends DolibarrApi // If the internal user must only see his customers, force searching by him $search_sale = 0; - if ($restrictonsocid && !DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) { + if ($restrictonsocid && !DolibarrApiAccess::$user->hasRight('societe', 'client', 'voir') && !$socid) { $search_sale = DolibarrApiAccess::$user->id; } diff --git a/htdocs/recruitment/core/modules/recruitment/mod_recruitmentcandidature_advanced.php b/htdocs/recruitment/core/modules/recruitment/mod_recruitmentcandidature_advanced.php index 7f7056a9db4..7cc19971cb3 100644 --- a/htdocs/recruitment/core/modules/recruitment/mod_recruitmentcandidature_advanced.php +++ b/htdocs/recruitment/core/modules/recruitment/mod_recruitmentcandidature_advanced.php @@ -119,7 +119,7 @@ class mod_recruitmentcandidature_advanced extends ModeleNumRefRecruitmentCandida * Return next free value * * @param Object $object Object we need next value for - * @return string Value if KO, <0 if KO + * @return string|0 Next value if OK, 0 if KO */ public function getNextValue($object) { diff --git a/htdocs/recruitment/core/modules/recruitment/mod_recruitmentcandidature_standard.php b/htdocs/recruitment/core/modules/recruitment/mod_recruitmentcandidature_standard.php index 24e3120c20f..dca26f27602 100644 --- a/htdocs/recruitment/core/modules/recruitment/mod_recruitmentcandidature_standard.php +++ b/htdocs/recruitment/core/modules/recruitment/mod_recruitmentcandidature_standard.php @@ -117,7 +117,7 @@ class mod_recruitmentcandidature_standard extends ModeleNumRefRecruitmentCandida * Return next free value * * @param Object $object Object we need next value for - * @return string Value if KO, <0 if KO + * @return string|-1 Next value if OK, -1 if KO */ public function getNextValue($object) { diff --git a/htdocs/recruitment/core/modules/recruitment/mod_recruitmentjobposition_advanced.php b/htdocs/recruitment/core/modules/recruitment/mod_recruitmentjobposition_advanced.php index 7d0eea8b7cb..4be33bfd352 100644 --- a/htdocs/recruitment/core/modules/recruitment/mod_recruitmentjobposition_advanced.php +++ b/htdocs/recruitment/core/modules/recruitment/mod_recruitmentjobposition_advanced.php @@ -119,7 +119,7 @@ class mod_recruitmentjobposition_advanced extends ModeleNumRefRecruitmentJobPosi * Return next free value * * @param Object $object Object we need next value for - * @return string Value if KO, <0 if KO + * @return string|0 Next value if OK, 0 if KO */ public function getNextValue($object) { diff --git a/htdocs/recruitment/core/modules/recruitment/mod_recruitmentjobposition_standard.php b/htdocs/recruitment/core/modules/recruitment/mod_recruitmentjobposition_standard.php index ba63ad8395c..09c69067887 100644 --- a/htdocs/recruitment/core/modules/recruitment/mod_recruitmentjobposition_standard.php +++ b/htdocs/recruitment/core/modules/recruitment/mod_recruitmentjobposition_standard.php @@ -117,7 +117,7 @@ class mod_recruitmentjobposition_standard extends ModeleNumRefRecruitmentJobPosi * Return next free value * * @param Object $object Object we need next value for - * @return string Value if KO, <0 if KO + * @return string|-1 Next value if OK, -1 if KO */ public function getNextValue($object) { diff --git a/htdocs/resource/card.php b/htdocs/resource/card.php index 1fd68eeec63..d44427bc1da 100644 --- a/htdocs/resource/card.php +++ b/htdocs/resource/card.php @@ -66,8 +66,8 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be includ $result = restrictedArea($user, 'resource', $object->id, 'resource'); -$permissiontoadd = $user->rights->resource->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php -$permissiontodelete = $user->rights->resource->delete; +$permissiontoadd = $user->hasRight('resource', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php +$permissiontodelete = $user->hasRight('resource', 'delete'); /* @@ -264,7 +264,7 @@ if ($action == 'create' || $object->fetch($id, $ref) > 0) { print '</td></tr>'; // State - if (empty($conf->global->SOCIETE_DISABLE_STATE)) { + if (!getDolGlobalString('SOCIETE_DISABLE_STATE')) { if ((getDolGlobalInt('MAIN_SHOW_REGION_IN_STATE_SELECT') == 1 || getDolGlobalInt('MAIN_SHOW_REGION_IN_STATE_SELECT') == 2)) { print '<tr><td>'.$form->editfieldkey('Region-State', 'state_id', '', $object, 0).'</td><td colspan="3" class="maxwidthonsmartphone">'; } else { diff --git a/htdocs/resource/class/html.formresource.class.php b/htdocs/resource/class/html.formresource.class.php index 888e3aa91c7..2e195026761 100644 --- a/htdocs/resource/class/html.formresource.class.php +++ b/htdocs/resource/class/html.formresource.class.php @@ -347,7 +347,7 @@ class FormResource // If translation exists use it, otherwise use default name if ( - !empty($conf->global->MAIN_SHOW_STATE_CODE) && + getDolGlobalString('MAIN_SHOW_STATE_CODE') && (getDolGlobalInt('MAIN_SHOW_STATE_CODE') == 1 || getDolGlobalInt('MAIN_SHOW_STATE_CODE') == 2 || $conf->global->MAIN_SHOW_STATE_CODE === 'all') ) { if (getDolGlobalInt('MAIN_SHOW_REGION_IN_STATE_SELECT') == 1) { diff --git a/htdocs/resource/document.php b/htdocs/resource/document.php index 7bb60594336..21d21e0901c 100644 --- a/htdocs/resource/document.php +++ b/htdocs/resource/document.php @@ -80,7 +80,7 @@ $modulepart = 'resource'; $result = restrictedArea($user, 'resource', $object->id, 'resource'); -$permissiontoadd = $user->rights->resource->write; // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles +$permissiontoadd = $user->hasRight('resource', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles /* @@ -146,7 +146,7 @@ if ($object->id > 0) { print dol_get_fiche_end(); $modulepart = 'dolresource'; - $permissiontoadd = $user->rights->resource->write; + $permissiontoadd = $user->hasRight('resource', 'write'); include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } else { diff --git a/htdocs/resource/note.php b/htdocs/resource/note.php index e5cc1819ead..f40c7adbd03 100644 --- a/htdocs/resource/note.php +++ b/htdocs/resource/note.php @@ -51,7 +51,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be includ $result = restrictedArea($user, 'resource', $object->id, 'resource'); -$permissionnote = $user->rights->resource->write; // Used by the include of actions_setnotes.inc.php +$permissionnote = $user->hasRight('resource', 'write'); // Used by the include of actions_setnotes.inc.php /* @@ -107,7 +107,7 @@ if ($id > 0 || !empty($ref)) { print '</div>'; - $permission = $user->rights->resource->write; + $permission = $user->hasRight('resource', 'write'); $cssclass = 'titlefield'; include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; diff --git a/htdocs/salaries/class/salary.class.php b/htdocs/salaries/class/salary.class.php index bf3af9539d1..344992f84cc 100644 --- a/htdocs/salaries/class/salary.class.php +++ b/htdocs/salaries/class/salary.class.php @@ -363,16 +363,6 @@ class Salary extends CommonObject $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Amount")); return -5; } - /* if (isModEnabled("banque") && (empty($this->accountid) || $this->accountid <= 0)) - { - $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Account")); - return -6; - } - if (isModEnabled("banque") && (empty($this->type_payment) || $this->type_payment <= 0)) - { - $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("PaymentMode")); - return -7; - }*/ $this->db->begin(); diff --git a/htdocs/salaries/list.php b/htdocs/salaries/list.php index f1e58537c7f..f7d20471545 100644 --- a/htdocs/salaries/list.php +++ b/htdocs/salaries/list.php @@ -142,9 +142,9 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); -$permissiontoread = $user->rights->salaries->read; -$permissiontoadd = $user->rights->salaries->write; -$permissiontodelete = $user->rights->salaries->delete; +$permissiontoread = $user->hasRight('salaries', 'read'); +$permissiontoadd = $user->hasRight('salaries', 'write'); +$permissiontodelete = $user->hasRight('salaries', 'delete'); // Security check $socid = GETPOST("socid", "int"); diff --git a/htdocs/salaries/payments.php b/htdocs/salaries/payments.php index c80070c78dd..e60f6211f9e 100644 --- a/htdocs/salaries/payments.php +++ b/htdocs/salaries/payments.php @@ -148,9 +148,9 @@ foreach ($object->fields as $key => $val) { } } -$permissiontoread = $user->rights->salaries->read; -$permissiontoadd = $user->rights->salaries->write; -$permissiontodelete = $user->rights->salaries->delete; +$permissiontoread = $user->hasRight('salaries', 'read'); +$permissiontoadd = $user->hasRight('salaries', 'write'); +$permissiontodelete = $user->hasRight('salaries', 'delete'); // Security check $socid = GETPOST("socid", "int"); @@ -416,7 +416,7 @@ $newcardbutton = ''; $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); $newcardbutton .= dolGetButtonTitleSeparator(); -$newcardbutton = dolGetButtonTitle($langs->trans('NewSalaryPayment'), '', 'fa fa-plus-circle', $url, '', $user->rights->salaries->write); +$newcardbutton = dolGetButtonTitle($langs->trans('NewSalaryPayment'), '', 'fa fa-plus-circle', $url, '', $user->hasRight('salaries', 'write')); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_payment', 0, $newcardbutton, '', $limit, 0, 0, 1); diff --git a/htdocs/salaries/virement_request.php b/htdocs/salaries/virement_request.php index e787a889e46..7829bc312a9 100644 --- a/htdocs/salaries/virement_request.php +++ b/htdocs/salaries/virement_request.php @@ -102,9 +102,9 @@ if ($id > 0 || !empty($ref)) { } } -$permissiontoread = $user->rights->salaries->read; -$permissiontoadd = $user->rights->salaries->write; // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles -$permissiontodelete = $user->rights->salaries->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_UNPAID); +$permissiontoread = $user->hasRight('salaries', 'read'); +$permissiontoadd = $user->hasRight('salaries', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles +$permissiontodelete = $user->hasRight('salaries', 'delete') || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_UNPAID); $moreparam = ''; if ($type == 'bank-transfer') { diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 623b14711fc..6acb18c39ad 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -112,6 +112,10 @@ if (!empty($backtopagejsfields)) { $socid = GETPOST('socid', 'int') ? GETPOST('socid', 'int') : GETPOST('id', 'int'); if ($user->socid) { + if (in_array($action, ['add', 'create', 'merge', 'confirm_merge', 'delete', 'confirm_delete'])) { + accessforbidden(); + } + $socid = $user->socid; } if (empty($socid) && $action == 'view') { @@ -1737,7 +1741,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio print '<td colspan="3" class="maxwidthonsmartphone">'; $userlist = $form->select_dolusers('', '', 0, null, 0, '', '', '0', 0, 0, 'AND u.statut = 1', 0, '', '', 0, 2); // Note: If user has no right to "see all thirdparties", we force selection of sale representative to him, so after creation he can see the record. - $selected = (count(GETPOST('commercial', 'array')) > 0 ? GETPOST('commercial', 'array') : (GETPOST('commercial', 'int') > 0 ? array(GETPOST('commercial', 'int')) : (empty($user->rights->societe->client->voir) ? array($user->id) : array()))); + $selected = (count(GETPOST('commercial', 'array')) > 0 ? GETPOST('commercial', 'array') : (GETPOST('commercial', 'int') > 0 ? array(GETPOST('commercial', 'int')) : (!$user->hasRight('societe', 'client', 'voir') ? array($user->id) : array()))); print img_picto('', 'user').$form->multiselectarray('commercial', $userlist, $selected, null, null, 'quatrevingtpercent widthcentpercentminusx', 0, 0); print '</td></tr>'; diff --git a/htdocs/societe/class/api_contacts.class.php b/htdocs/societe/class/api_contacts.class.php index 3a05843410b..eda54cd3d41 100644 --- a/htdocs/societe/class/api_contacts.class.php +++ b/htdocs/societe/class/api_contacts.class.php @@ -71,7 +71,7 @@ class Contacts extends DolibarrApi */ public function get($id, $includecount = 0, $includeroles = 0) { - if (!DolibarrApiAccess::$user->rights->societe->contact->lire) { + if (!DolibarrApiAccess::$user->hasRight('societe', 'contact', 'lire')) { throw new RestException(401, 'No permission to read contacts'); } @@ -119,7 +119,7 @@ class Contacts extends DolibarrApi */ public function getByEmail($email, $includecount = 0, $includeroles = 0) { - if (!DolibarrApiAccess::$user->rights->societe->contact->lire) { + if (!DolibarrApiAccess::$user->hasRight('societe', 'contact', 'lire')) { throw new RestException(401, 'No permission to read contacts'); } @@ -177,7 +177,7 @@ class Contacts extends DolibarrApi $obj_ret = array(); - if (!DolibarrApiAccess::$user->rights->societe->contact->lire) { + if (!DolibarrApiAccess::$user->hasRight('societe', 'contact', 'lire')) { throw new RestException(401, 'No permission to read contacts'); } @@ -186,7 +186,7 @@ class Contacts extends DolibarrApi // If the internal user must only see his customers, force searching by him $search_sale = 0; - if (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) { + if (!DolibarrApiAccess::$user->hasRight('societe', 'client', 'voir') && !$socids) { $search_sale = DolibarrApiAccess::$user->id; } @@ -276,7 +276,7 @@ class Contacts extends DolibarrApi */ public function post($request_data = null) { - if (!DolibarrApiAccess::$user->rights->societe->contact->creer) { + if (!DolibarrApiAccess::$user->hasRight('societe', 'contact', 'creer')) { throw new RestException(401, 'No permission to create/update contacts'); } // Check mandatory fields @@ -315,7 +315,7 @@ class Contacts extends DolibarrApi */ public function put($id, $request_data = null) { - if (!DolibarrApiAccess::$user->rights->societe->contact->creer) { + if (!DolibarrApiAccess::$user->hasRight('societe', 'contact', 'creer')) { throw new RestException(401, 'No permission to create/update contacts'); } @@ -366,7 +366,7 @@ class Contacts extends DolibarrApi */ public function delete($id) { - if (!DolibarrApiAccess::$user->rights->societe->contact->supprimer) { + if (!DolibarrApiAccess::$user->hasRight('societe', 'contact', 'supprimer')) { throw new RestException(401, 'No permission to delete contacts'); } $result = $this->contact->fetch($id); @@ -403,7 +403,7 @@ class Contacts extends DolibarrApi throw new RestException(400, "password field missing"); } - if (!DolibarrApiAccess::$user->rights->societe->contact->lire) { + if (!DolibarrApiAccess::$user->hasRight('societe', 'contact', 'lire')) { throw new RestException(403, 'No permission to read contacts'); } if (!DolibarrApiAccess::$user->hasRight('user', 'user', 'creer')) { @@ -449,7 +449,7 @@ class Contacts extends DolibarrApi */ public function getCategories($id, $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0) { - if (!DolibarrApiAccess::$user->rights->categorie->lire) { + if (!DolibarrApiAccess::$user->hasRight('categorie', 'lire')) { throw new RestException(403); } @@ -479,7 +479,7 @@ class Contacts extends DolibarrApi */ public function addCategory($id, $category_id) { - if (!DolibarrApiAccess::$user->rights->societe->contact->creer) { + if (!DolibarrApiAccess::$user->hasRight('societe', 'contact', 'creer')) { throw new RestException(401, 'Insufficient rights'); } @@ -519,7 +519,7 @@ class Contacts extends DolibarrApi */ public function deleteCategory($id, $category_id) { - if (!DolibarrApiAccess::$user->rights->societe->contact->creer) { + if (!DolibarrApiAccess::$user->hasRight('societe', 'contact', 'creer')) { throw new RestException(401, 'Insufficient rights'); } diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index d4f783470bd..b0c101796f0 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -143,7 +143,7 @@ class Thirdparties extends DolibarrApi // If the internal user must only see his customers, force searching by him $search_sale = 0; - if (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) { + if (!DolibarrApiAccess::$user->hasRight('societe', 'client', 'voir') && !$socids) { $search_sale = DolibarrApiAccess::$user->id; } @@ -244,7 +244,7 @@ class Thirdparties extends DolibarrApi */ public function post($request_data = null) { - if (!DolibarrApiAccess::$user->rights->societe->creer) { + if (!DolibarrApiAccess::$user->hasRight('societe', 'creer')) { throw new RestException(403); } // Check mandatory fields @@ -279,7 +279,7 @@ class Thirdparties extends DolibarrApi */ public function put($id, $request_data = null) { - if (!DolibarrApiAccess::$user->rights->societe->creer) { + if (!DolibarrApiAccess::$user->hasRight('societe', 'creer')) { throw new RestException(403); } @@ -340,7 +340,7 @@ class Thirdparties extends DolibarrApi throw new RestException(400, 'Try to merge a thirdparty into itself'); } - if (!DolibarrApiAccess::$user->rights->societe->creer) { + if (!DolibarrApiAccess::$user->hasRight('societe', 'creer')) { throw new RestException(403); } @@ -438,11 +438,11 @@ class Thirdparties extends DolibarrApi throw new RestException(501, 'Multiprices features activation needed for this request'); } - if ($priceLevel < 1 || $priceLevel > $conf->global->PRODUIT_MULTIPRICES_LIMIT) { + if ($priceLevel < 1 || $priceLevel > getDolGlobalString('PRODUIT_MULTIPRICES_LIMIT')) { throw new RestException(400, 'Price level must be between 1 and ' . getDolGlobalString('PRODUIT_MULTIPRICES_LIMIT')); } - if (empty(DolibarrApiAccess::$user->rights->societe->creer)) { + if (!DolibarrApiAccess::$user->hasRight('societe', 'creer')) { throw new RestException(401, 'Access to thirdparty '.$id.' not allowed for login '.DolibarrApiAccess::$user->login); } @@ -467,6 +467,68 @@ class Thirdparties extends DolibarrApi return $this->_cleanObjectDatas($this->company); } + /** + * Add a customer representative to a thirdparty + * + * @param int $id Id of thirdparty + * @param int $representative_id Id of representative + * @return Object|void + * + * @url POST {id}/representative/{representative_id} + */ + public function addRepresentative($id, $representative_id) + { + if (!DolibarrApiAccess::$user->hasRight('societe', 'creer')) { + throw new RestException(403); + } + $result = $this->company->fetch($id); + if (!$result) { + throw new RestException(404, 'Thirdparty not found'); + } + $usertmp = new User($this->db); + $result = $usertmp->fetch($representative_id); + if (!$result) { + throw new RestException(404, 'User not found'); + } + if (!DolibarrApi::_checkAccessToResource('societe', $this->company->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + $result = $this->company->add_commercial(DolibarrApiAccess::$user, $representative_id); + + return $result; + } + + /** + * Delete a customer representative to a thirdparty + * + * @param int $id Id of thirdparty + * @param int $representative_id Id of representative + * @return Object|void + * + * @url DELETE {id}/representative/{representative_id} + */ + public function deleteRepresentative($id, $representative_id) + { + if (!DolibarrApiAccess::$user->hasRight('societe', 'supprimer')) { + throw new RestException(403); + } + $result = $this->company->fetch($id); + if (!$result) { + throw new RestException(404, 'Thirdparty not found'); + } + $usertmp = new User($this->db); + $result = $usertmp->fetch($representative_id); + if (!$result) { + throw new RestException(404, 'User not found'); + } + if (!DolibarrApi::_checkAccessToResource('societe', $this->company->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + $result = $this->company->del_commercial(DolibarrApiAccess::$user, $representative_id); + + return $result; + } + /** * Get customer categories for a thirdparty * @@ -481,7 +543,7 @@ class Thirdparties extends DolibarrApi */ public function getCategories($id, $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0) { - if (!DolibarrApiAccess::$user->rights->categorie->lire) { + if (!DolibarrApiAccess::$user->hasRight('categorie', 'lire')) { throw new RestException(403); } @@ -516,7 +578,7 @@ class Thirdparties extends DolibarrApi */ public function addCategory($id, $category_id) { - if (!DolibarrApiAccess::$user->rights->societe->creer) { + if (!DolibarrApiAccess::$user->hasRight('societe', 'creer')) { throw new RestException(403); } @@ -554,7 +616,7 @@ class Thirdparties extends DolibarrApi */ public function deleteCategory($id, $category_id) { - if (!DolibarrApiAccess::$user->rights->societe->creer) { + if (!DolibarrApiAccess::$user->hasRight('societe', 'creer')) { throw new RestException(403); } @@ -595,7 +657,7 @@ class Thirdparties extends DolibarrApi */ public function getSupplierCategories($id, $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0) { - if (!DolibarrApiAccess::$user->rights->categorie->lire) { + if (!DolibarrApiAccess::$user->hasRight('categorie', 'lire')) { throw new RestException(403); } @@ -631,7 +693,7 @@ class Thirdparties extends DolibarrApi */ public function addSupplierCategory($id, $category_id) { - if (!DolibarrApiAccess::$user->rights->societe->creer) { + if (!DolibarrApiAccess::$user->hasRight('societe', 'creer')) { throw new RestException(403); } @@ -669,7 +731,7 @@ class Thirdparties extends DolibarrApi */ public function deleteSupplierCategory($id, $category_id) { - if (!DolibarrApiAccess::$user->rights->societe->creer) { + if (!DolibarrApiAccess::$user->hasRight('societe', 'creer')) { throw new RestException(403); } @@ -1018,7 +1080,7 @@ class Thirdparties extends DolibarrApi */ public function getCompanyBankAccount($id) { - if (!DolibarrApiAccess::$user->rights->societe->lire) { + if (!DolibarrApiAccess::$user->hasRight('societe', 'lire')) { throw new RestException(403); } if (empty($id)) { @@ -1093,7 +1155,7 @@ class Thirdparties extends DolibarrApi */ public function createCompanyBankAccount($id, $request_data = null) { - if (!DolibarrApiAccess::$user->rights->societe->creer) { + if (!DolibarrApiAccess::$user->hasRight('societe', 'creer')) { throw new RestException(403); } if ($this->company->fetch($id) <= 0) { @@ -1144,7 +1206,7 @@ class Thirdparties extends DolibarrApi */ public function updateCompanyBankAccount($id, $bankaccount_id, $request_data = null) { - if (!DolibarrApiAccess::$user->rights->societe->creer) { + if (!DolibarrApiAccess::$user->hasRight('societe', 'creer')) { throw new RestException(403); } if ($this->company->fetch($id) <= 0) { @@ -1195,7 +1257,7 @@ class Thirdparties extends DolibarrApi */ public function deleteCompanyBankAccount($id, $bankaccount_id) { - if (!DolibarrApiAccess::$user->rights->societe->creer) { + if (!DolibarrApiAccess::$user->hasRight('societe', 'creer')) { throw new RestException(403); } @@ -1230,7 +1292,7 @@ class Thirdparties extends DolibarrApi throw new RestException(404, 'Thirdparty not found'); } - if (!DolibarrApiAccess::$user->rights->societe->creer) { + if (!DolibarrApiAccess::$user->hasRight('societe', 'creer')) { throw new RestException(403); } @@ -1391,7 +1453,7 @@ class Thirdparties extends DolibarrApi */ public function createSocieteAccount($id, $request_data = null) { - if (!DolibarrApiAccess::$user->rights->societe->creer) { + if (!DolibarrApiAccess::$user->hasRight('societe', 'creer')) { throw new RestException(403); } @@ -1455,7 +1517,7 @@ class Thirdparties extends DolibarrApi */ public function putSocieteAccount($id, $site, $request_data = null) { - if (!DolibarrApiAccess::$user->rights->societe->creer) { + if (!DolibarrApiAccess::$user->hasRight('societe', 'creer')) { throw new RestException(403); } @@ -1549,7 +1611,7 @@ class Thirdparties extends DolibarrApi */ public function patchSocieteAccount($id, $site, $request_data = null) { - if (!DolibarrApiAccess::$user->rights->societe->creer) { + if (!DolibarrApiAccess::$user->hasRight('societe', 'creer')) { throw new RestException(403); } @@ -1608,7 +1670,7 @@ class Thirdparties extends DolibarrApi */ public function deleteSocieteAccount($id, $site) { - if (!DolibarrApiAccess::$user->rights->societe->creer) { + if (!DolibarrApiAccess::$user->hasRight('societe', 'creer')) { throw new RestException(403); } @@ -1642,7 +1704,7 @@ class Thirdparties extends DolibarrApi */ public function deleteSocieteAccounts($id) { - if (!DolibarrApiAccess::$user->rights->societe->creer) { + if (!DolibarrApiAccess::$user->hasRight('societe', 'creer')) { throw new RestException(403); } diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index e45ea6690c1..6822e832fc9 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -2664,7 +2664,7 @@ class Societe extends CommonObject * * @param User $user Object user * @param int $commid Id of user - * @return void + * @return int Return <0 if KO, >0 if OK */ public function del_commercial(User $user, $commid) { @@ -2682,9 +2682,16 @@ class Societe extends CommonObject $sql .= " WHERE fk_soc = ".((int) $this->id)." AND fk_user = ".((int) $commid); if (!$this->db->query($sql)) { + $error++; dol_syslog(get_class($this)."::del_commercial Erreur"); } } + + if ($error) { + return -1; + } else { + return 1; + } } /** @@ -4032,7 +4039,7 @@ class Societe extends CommonObject $isACompany = 1; } } - return boolval($isACompany); + return (bool) $isACompany; } /** @@ -5295,7 +5302,7 @@ class Societe extends CommonObject */ public function mergeCompany($soc_origin_id) { - global $langs, $hookmanager, $user, $action; + global $conf, $langs, $hookmanager, $user, $action; $error = 0; $soc_origin = new Societe($this->db); // The thirdparty that we will delete @@ -5317,9 +5324,9 @@ class Societe extends CommonObject 'address', 'zip', 'town', 'state_id', 'country_id', 'phone', 'fax', 'email', 'socialnetworks', 'url', 'barcode', 'idprof1', 'idprof2', 'idprof3', 'idprof4', 'idprof5', 'idprof6', 'tva_intra', 'effectif_id', 'forme_juridique', 'remise_percent', 'remise_supplier_percent', 'mode_reglement_supplier_id', 'cond_reglement_supplier_id', 'name_bis', - 'stcomm_id', 'outstanding_limit', 'price_level', 'parent', 'default_lang', 'ref', 'ref_ext', 'import_key', 'fk_incoterms', 'fk_multicurrency', + 'stcomm_id', 'outstanding_limit', 'order_min_amount', 'supplier_order_min_amount', 'price_level', 'parent', 'default_lang', 'ref', 'ref_ext', 'import_key', 'fk_incoterms', 'fk_multicurrency', 'code_client', 'code_fournisseur', 'code_compta', 'code_compta_fournisseur', - 'model_pdf', + 'model_pdf', 'webservices_url', 'webservices_key', 'accountancy_code_sell', 'accountancy_code_buy' ); foreach ($listofproperties as $property) { if (empty($this->$property)) { @@ -5384,9 +5391,8 @@ class Societe extends CommonObject if (!$error) { $objects = array( 'Adherent' => '/adherents/class/adherent.class.php', - 'Don' => array('file' => '/don/class/don.class.php', 'enabled' => isModEnabled('don')), 'Societe' => '/societe/class/societe.class.php', - //'Categorie' => '/categories/class/categorie.class.php', + //'Categorie' => '/categories/class/categorie.class.php', // Already processed previously 'ActionComm' => '/comm/action/class/actioncomm.class.php', 'Propal' => '/comm/propal/class/propal.class.php', 'Commande' => '/commande/class/commande.class.php', @@ -5397,7 +5403,6 @@ class Societe extends CommonObject 'Contact' => '/contact/class/contact.class.php', 'Contrat' => '/contrat/class/contrat.class.php', 'Expedition' => '/expedition/class/expedition.class.php', - 'Fichinter' => '/fichinter/class/fichinter.class.php', 'CommandeFournisseur' => '/fourn/class/fournisseur.commande.class.php', 'FactureFournisseur' => '/fourn/class/fournisseur.facture.class.php', 'FactureFournisseurRec' => '/fourn/class/fournisseur.facture-rec.class.php', @@ -5407,11 +5412,22 @@ class Societe extends CommonObject 'Delivery' => '/delivery/class/delivery.class.php', 'Product' => '/product/class/product.class.php', 'Project' => '/projet/class/project.class.php', - 'Ticket' => array('file' => '/ticket/class/ticket.class.php', 'enabled' => isModEnabled('ticket')), 'User' => '/user/class/user.class.php', 'Account' => '/compta/bank/class/account.class.php', 'ConferenceOrBoothAttendee' => '/eventorganization/class/conferenceorboothattendee.class.php' ); + if ($this->db->DDLListTables($conf->db->name, $this->db->prefix().'don')) { + $objects['Don'] = '/don/class/don.class.php'; + } + if ($this->db->DDLListTables($conf->db->name, $this->db->prefix().'partnership')) { + $objects['PartnerShip'] = '/partnership/class/partnership.class.php'; + } + if ($this->db->DDLListTables($conf->db->name, $this->db->prefix().'fichinter')) { + $objects['Fichinter'] = '/fichinter/class/fichinter.class.php'; + } + if ($this->db->DDLListTables($conf->db->name, $this->db->prefix().'ticket')) { + $objects['Ticket'] = '/ticket/class/ticket.class.php'; + } //First, all core objects must update their tables foreach ($objects as $object_name => $object_file) { diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index 5c7e2e58749..5f15d0e031d 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -82,7 +82,7 @@ $hookmanager->initHooks(array('thirdpartybancard', 'globalcard')); $permissiontoread = $user->hasRight('societe', 'lire'); $permissiontoadd = $user->hasRight('societe', 'creer'); // Used by the include of actions_addupdatedelete.inc.php and actions_builddoc.inc.php -$permissiontoaddupdatepaymentinformation = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $permissiontoadd) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !empty($user->rights->societe->thirdparty_paymentinformation_advance->write))); +$permissiontoaddupdatepaymentinformation = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $permissiontoadd) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('societe', 'thirdparty_paymentinformation_advance', 'write'))); // Check permission on company diff --git a/htdocs/societe/website.php b/htdocs/societe/website.php index 9b1bb4c14c2..9b7d0d44087 100644 --- a/htdocs/societe/website.php +++ b/htdocs/societe/website.php @@ -664,8 +664,8 @@ if (in_array('builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords $urlsource .= str_replace('&', '&', $param); $filedir = $diroutputmassaction; - $genallowed = $user->rights->mymodule->read; - $delallowed = $user->rights->mymodule->create; + $genallowed = $user->hasRight('mymodule', 'read'); + $delallowed = $user->hasRight('mymodule', 'create'); print $formfile->showdocuments('massfilesarea_mymodule', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty); } diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 4567e6b823f..1127a921131 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -104,16 +104,16 @@ if ($id > 0 || !empty($ref)) { } // Common permissions -$usercanread = $user->rights->supplier_proposal->lire; -$usercancreate = $user->rights->supplier_proposal->creer; -$usercandelete = $user->rights->supplier_proposal->supprimer; +$usercanread = $user->hasRight('supplier_proposal', 'lire'); +$usercancreate = $user->hasRight('supplier_proposal', 'creer'); +$usercandelete = $user->hasRight('supplier_proposal', 'supprimer'); // Advanced permissions -$usercanvalidate = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !empty($usercancreate)) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !empty($user->rights->supplier_proposal->validate_advance))); +$usercanvalidate = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !empty($usercancreate)) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('supplier_proposal', 'validate_advance'))); $usercansend = (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') || $user->rights->supplier_proposal->send_advance); // Additional area permissions -$usercanclose = $user->rights->supplier_proposal->cloturer; +$usercanclose = $user->hasRight('supplier_proposal', 'cloturer'); $usercancreateorder = ($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer); // Permissions for includes diff --git a/htdocs/supplier_proposal/class/api_supplier_proposals.class.php b/htdocs/supplier_proposal/class/api_supplier_proposals.class.php index be4140a8638..bde171e7d68 100644 --- a/htdocs/supplier_proposal/class/api_supplier_proposals.class.php +++ b/htdocs/supplier_proposal/class/api_supplier_proposals.class.php @@ -63,7 +63,7 @@ class SupplierProposals extends DolibarrApi */ public function get($id) { - if (!DolibarrApiAccess::$user->rights->supplier_proposal->lire) { + if (!DolibarrApiAccess::$user->hasRight('supplier_proposal', 'lire')) { throw new RestException(403); } @@ -96,7 +96,7 @@ class SupplierProposals extends DolibarrApi */ public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '', $properties = '') { - if (!DolibarrApiAccess::$user->rights->supplier_proposal->lire) { + if (!DolibarrApiAccess::$user->hasRight('supplier_proposal', 'lire')) { throw new RestException(403); } @@ -107,7 +107,7 @@ class SupplierProposals extends DolibarrApi // If the internal user must only see his customers, force searching by him $search_sale = 0; - if (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) { + if (!DolibarrApiAccess::$user->hasRight('societe', 'client', 'voir') && !$socids) { $search_sale = DolibarrApiAccess::$user->id; } diff --git a/htdocs/supplier_proposal/document.php b/htdocs/supplier_proposal/document.php index 6ac79342692..70c70a9bfe9 100644 --- a/htdocs/supplier_proposal/document.php +++ b/htdocs/supplier_proposal/document.php @@ -76,7 +76,7 @@ if ($object->id > 0) { $upload_dir = $conf->supplier_proposal->dir_output.'/'.dol_sanitizeFileName($object->ref); } -$permissiontoadd = $user->rights->supplier_proposal->creer; +$permissiontoadd = $user->hasRight('supplier_proposal', 'creer'); $usercancreate = $permissiontoadd; /* @@ -164,8 +164,8 @@ if ($object->id > 0) { print dol_get_fiche_end(); $modulepart = 'supplier_proposal'; - $permissiontoadd = $user->rights->supplier_proposal->creer; - $permtoedit = $user->rights->supplier_proposal->creer; + $permissiontoadd = $user->hasRight('supplier_proposal', 'creer'); + $permtoedit = $user->hasRight('supplier_proposal', 'creer'); $param = '&id='.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } else { diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index c5b95580701..b15417f1868 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -204,8 +204,8 @@ if (!$user->hasRight('societe', 'client', 'voir')) { $result = restrictedArea($user, $module, $objectid, $dbtable); -$permissiontoread = $user->rights->supplier_proposal->lire; -$permissiontodelete = $user->rights->supplier_proposal->supprimer; +$permissiontoread = $user->hasRight('supplier_proposal', 'lire'); +$permissiontodelete = $user->hasRight('supplier_proposal', 'supprimer'); /* @@ -1358,8 +1358,8 @@ if ($resql) { $filedir = $diroutputmassaction; - $genallowed = $user->rights->supplier_proposal->lire; - $delallowed = $user->rights->supplier_proposal->creer; + $genallowed = $user->hasRight('supplier_proposal', 'lire'); + $delallowed = $user->hasRight('supplier_proposal', 'creer'); print $formfile->showdocuments('massfilesarea_supplier_proposal', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty); } else { diff --git a/htdocs/supplier_proposal/note.php b/htdocs/supplier_proposal/note.php index 147b1299e22..964653459f9 100644 --- a/htdocs/supplier_proposal/note.php +++ b/htdocs/supplier_proposal/note.php @@ -61,7 +61,7 @@ $usercancreate = $user->hasRight("supplier_propal", "write"); * Actions */ -$permissionnote = $user->rights->supplier_proposal->creer; // Used by the include of actions_setnotes.inc.php +$permissionnote = $user->hasRight('supplier_proposal', 'creer'); // Used by the include of actions_setnotes.inc.php $parameters = array(); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 7394a021106..7d00ff12076 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -840,7 +840,7 @@ if (empty($reshook)) { $prod->fetch($line->fk_product); $datapriceofproduct = $prod->getSellPrice($mysoc, $customer, 0); $price_min = $datapriceofproduct['price_min']; - $usercanproductignorepricemin = ((getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && empty($user->rights->produit->ignore_price_min_advance)) || !getDolGlobalString('MAIN_USE_ADVANCED_PERMS')); + $usercanproductignorepricemin = ((getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !$user->hasRight('produit', 'ignore_price_min_advance')) || !getDolGlobalString('MAIN_USE_ADVANCED_PERMS')); $pu_ht = price2num($number / (1 + ($line->tva_tx / 100)), 'MU'); //Check min price if ($usercanproductignorepricemin && (!empty($price_min) && (price2num($pu_ht) * (1 - price2num($line->remise_percent) / 100) < price2num($price_min)))) { @@ -884,7 +884,7 @@ if (empty($reshook)) { $datapriceofproduct = $prod->getSellPrice($mysoc, $customer, 0); $price_min = $datapriceofproduct['price_min']; - $usercanproductignorepricemin = ((getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && empty($user->rights->produit->ignore_price_min_advance)) || !getDolGlobalString('MAIN_USE_ADVANCED_PERMS')); + $usercanproductignorepricemin = ((getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !$user->hasRight('produit', 'ignore_price_min_advance')) || !getDolGlobalString('MAIN_USE_ADVANCED_PERMS')); $pu_ht = price2num($line->subprice / (1 + ($line->tva_tx / 100)), 'MU'); diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index af1eaadd355..705dfb4c760 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -1032,7 +1032,7 @@ body[class*="colorblind-"] .text-success{ color : <?php print $textDanger; ?> } -.editfielda span.fa-pencil-alt, .editfielda span.fa-pencil-ruler, .editfielda span.fa-trash, .editfielda span.fa-crop, +.editfielda span.fa-pencil-alt, .editfielda span.fa-pencil-ruler, .editfielda span.fa-trash, .editfielda span.fa-crop, .editfielda span.fa-eye, .editfieldlang { color: #ccc !important; } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 2c344cf9e5f..1df5f807c06 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -1289,7 +1289,7 @@ body[class*="colorblind-"] .text-success{ color : <?php print $textDanger; ?> } -.editfielda span.fa-pencil-alt, .editfielda span.fa-pencil-ruler, .editfielda span.fa-trash, .editfielda span.fa-crop, +.editfielda span.fa-pencil-alt, .editfielda span.fa-pencil-ruler, .editfielda span.fa-trash, .editfielda span.fa-crop, .editfielda span.fa-eye, .editfieldlang { color: #ccc !important; } @@ -4513,7 +4513,7 @@ tr.liste_titre th, tr.liste_titre td, th.liste_titre { border-bottom: 1px solid #aaa; } -/* TODO Once title line is moved under title search, make border bottom of all th black and force to whit when it's first tr */ +/* TODO Once the title line is moved under title search, make th border bottoms black and force to white when it's the first tr */ tr:first-child th.liste_titre, tr:first-child th.liste_titre_sel { border-bottom: 1px solid #FFF ! important; } diff --git a/htdocs/ticket/agenda.php b/htdocs/ticket/agenda.php index ca6150fb366..fe040dde435 100644 --- a/htdocs/ticket/agenda.php +++ b/htdocs/ticket/agenda.php @@ -105,7 +105,7 @@ if (!$user->socid && (getDolGlobalString('TICKET_LIMIT_VIEW_ASSIGNED_ONLY') && $ accessforbidden(); } -$permissiontoadd = $user->rights->ticket->write; +$permissiontoadd = $user->hasRight('ticket', 'write'); /* diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index a909b942c92..e731f0ad230 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -761,7 +761,7 @@ if ($action == 'create' || $action == 'presend') { $formticket->withcancel = 1; $formticket->showForm(1, 'create', 0, null, $action); - /*} elseif ($action == 'edit' && $user->rights->ticket->write && $object->status < Ticket::STATUS_CLOSED) { + /*} elseif ($action == 'edit' && $user->hasRight('ticket', 'write') && $object->status < Ticket::STATUS_CLOSED) { $formticket = new FormTicket($db); $head = ticket_prepare_head($object); @@ -969,7 +969,7 @@ if ($action == 'create' || $action == 'presend') { $morehtmlref .= dol_escape_htmltag($object->origin_email).' <small class="hideonsmartphone opacitymedium">- '.$form->textwithpicto($langs->trans("CreatedByPublicPortal"), $htmltooptip, 1, 'help', '', 0, 3, 'tooltip').'</small>'; } - $permissiontoedit = $object->status < 8 && !$user->socid && $user->rights->ticket->write; + $permissiontoedit = $object->status < 8 && !$user->socid && $user->hasRight('ticket', 'write'); //$permissiontoedit = 0; // Thirdparty diff --git a/htdocs/ticket/class/api_tickets.class.php b/htdocs/ticket/class/api_tickets.class.php index e4641f65b4a..0b7f6625847 100644 --- a/htdocs/ticket/class/api_tickets.class.php +++ b/htdocs/ticket/class/api_tickets.class.php @@ -126,7 +126,7 @@ class Tickets extends DolibarrApi */ private function getCommon($id = 0, $track_id = '', $ref = '') { - if (!DolibarrApiAccess::$user->rights->ticket->read) { + if (!DolibarrApiAccess::$user->hasRight('ticket', 'read')) { throw new RestException(403); } @@ -201,7 +201,7 @@ class Tickets extends DolibarrApi */ public function index($socid = 0, $sortfield = "t.rowid", $sortorder = "ASC", $limit = 100, $page = 0, $sqlfilters = '', $properties = '') { - if (!DolibarrApiAccess::$user->rights->ticket->read) { + if (!DolibarrApiAccess::$user->hasRight('ticket', 'read')) { throw new RestException(403); } @@ -212,7 +212,7 @@ class Tickets extends DolibarrApi $search_sale = null; // If the internal user must only see his customers, force searching by him $search_sale = 0; - if (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) { + if (!DolibarrApiAccess::$user->hasRight('societe', 'client', 'voir') && !$socid) { $search_sale = DolibarrApiAccess::$user->id; } @@ -284,7 +284,7 @@ class Tickets extends DolibarrApi public function post($request_data = null) { $ticketstatic = new Ticket($this->db); - if (!DolibarrApiAccess::$user->rights->ticket->write) { + if (!DolibarrApiAccess::$user->hasRight('ticket', 'write')) { throw new RestException(403); } // Check mandatory fields @@ -323,7 +323,7 @@ class Tickets extends DolibarrApi public function postNewMessage($request_data = null) { $ticketstatic = new Ticket($this->db); - if (!DolibarrApiAccess::$user->rights->ticket->write) { + if (!DolibarrApiAccess::$user->hasRight('ticket', 'write')) { throw new RestException(403); } // Check mandatory fields @@ -360,7 +360,7 @@ class Tickets extends DolibarrApi */ public function put($id, $request_data = null) { - if (!DolibarrApiAccess::$user->rights->ticket->write) { + if (!DolibarrApiAccess::$user->hasRight('ticket', 'write')) { throw new RestException(403); } @@ -399,7 +399,7 @@ class Tickets extends DolibarrApi */ public function delete($id) { - if (!DolibarrApiAccess::$user->rights->ticket->delete) { + if (!DolibarrApiAccess::$user->hasRight('ticket', 'delete')) { throw new RestException(403); } $result = $this->ticket->fetch($id); diff --git a/htdocs/ticket/class/ticketstats.class.php b/htdocs/ticket/class/ticketstats.class.php index 95f807f0ebf..8ac77532d96 100644 --- a/htdocs/ticket/class/ticketstats.class.php +++ b/htdocs/ticket/class/ticketstats.class.php @@ -91,7 +91,7 @@ class TicketStats extends Stats /** * Return the number of tickets per month for a given year * - * @param string $year Year to scan + * @param int $year Year to scan * @param int $format 0=Label of abscissa is a translated text, 1=Label of abscissa is month number, 2=Label of abscissa is first letter of month * @return array Array of values */ diff --git a/htdocs/ticket/contact.php b/htdocs/ticket/contact.php index b79c2501b85..a2bbe08be55 100644 --- a/htdocs/ticket/contact.php +++ b/htdocs/ticket/contact.php @@ -78,7 +78,7 @@ if (!$user->socid && (getDolGlobalString('TICKET_LIMIT_VIEW_ASSIGNED_ONLY') && $ accessforbidden(); } -$permissiontoadd = $user->rights->ticket->write; +$permissiontoadd = $user->hasRight('ticket', 'write'); /* @@ -268,7 +268,7 @@ if ($id > 0 || !empty($track_id) || !empty($ref)) { //print '<br>'; - $permission = $user->rights->ticket->write; + $permission = $user->hasRight('ticket', 'write'); // Contacts lines (modules that overwrite templates must declare this into descriptor) $dirtpls = array_merge($conf->modules_parts['tpl'], array('/core/tpl')); diff --git a/htdocs/ticket/document.php b/htdocs/ticket/document.php index 20642564918..00b848f240d 100644 --- a/htdocs/ticket/document.php +++ b/htdocs/ticket/document.php @@ -91,7 +91,7 @@ if (!$user->socid && getDolGlobalString('TICKET_LIMIT_VIEW_ASSIGNED_ONLY') && $o accessforbidden(); } -$permissiontoadd = $user->rights->ticket->write; // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles +$permissiontoadd = $user->hasRight('ticket', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles /* @@ -211,8 +211,8 @@ if ($object->id) { //$object->ref = $object->track_id; // For compatibility we use track ID for directory $modulepart = 'ticket'; - $permissiontoadd = $user->rights->ticket->write; - $permtoedit = $user->rights->ticket->write; + $permissiontoadd = $user->hasRight('ticket', 'write'); + $permtoedit = $user->hasRight('ticket', 'write'); $param = '&id='.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index 95cfbad7bc7..40d58535e49 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -177,9 +177,9 @@ if ($project_ref) { $search_fk_project = $projectid; } -$permissiontoread = $user->rights->ticket->read; -$permissiontoadd = $user->rights->ticket->write; -$permissiontodelete = $user->rights->ticket->delete; +$permissiontoread = $user->hasRight('ticket', 'read'); +$permissiontoadd = $user->hasRight('ticket', 'write'); +$permissiontodelete = $user->hasRight('ticket', 'delete'); $error = 0; diff --git a/htdocs/ticket/messaging.php b/htdocs/ticket/messaging.php index 7eed20c1f93..7daf2518b1f 100644 --- a/htdocs/ticket/messaging.php +++ b/htdocs/ticket/messaging.php @@ -102,7 +102,7 @@ if (!$user->socid && (getDolGlobalString('TICKET_LIMIT_VIEW_ASSIGNED_ONLY') && $ accessforbidden(); } -$permissiontoadd = $user->rights->ticket->write; +$permissiontoadd = $user->hasRight('ticket', 'write'); /* diff --git a/htdocs/ticket/stats/index.php b/htdocs/ticket/stats/index.php index 5bd47cff622..9351dc74a5c 100644 --- a/htdocs/ticket/stats/index.php +++ b/htdocs/ticket/stats/index.php @@ -121,73 +121,6 @@ $data = $stats->getAmountByMonthWithPrevYear($endyear, $startyear); // $data = array(array('Lib',val1,val2,val3),...) -/*if (empty($user->rights->societe->client->voir) || $user->socid) { - $filenameamount = $dir.'/ticketsamountinyear-'.$user->id.'-'.$year.'.png'; - $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=ticketstats&file=ticketsamountinyear-'.$user->id.'-'.$year.'.png'; -} else { - $filenameamount = $dir.'/ticketsamountinyear-'.$year.'.png'; - $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=ticketstats&file=ticketsamountinyear-'.$year.'.png'; -} - -$px2 = new DolGraph(); -$mesg = $px2->isGraphKo(); -if (!$mesg) { - $px2->SetData($data); - $i = $startyear; $legend = array(); - while ($i <= $endyear) { - $legend[] = $i; - $i++; - } - $px2->SetLegend($legend); - $px2->SetMaxValue($px2->GetCeilMaxValue()); - $px2->SetMinValue(min(0, $px2->GetFloorMinValue())); - $px2->SetWidth($WIDTH); - $px2->SetHeight($HEIGHT); - $px2->SetYLabel($langs->trans("AmountOfTickets")); - $px2->SetShading(3); - $px2->SetHorizTickIncrement(1); - $px2->mode = 'depth'; - $px2->SetTitle($langs->trans("AmountOfTicketsByMonthHT")); - - $px2->draw($filenameamount, $fileurlamount); -} - - -$data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear); - -if (empty($user->rights->societe->client->voir) || $user->socid) { - $filename_avg = $dir.'/ticketsaverage-'.$user->id.'-'.$year.'.png'; - $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=ticketstats&file=ticketsaverage-'.$user->id.'-'.$year.'.png'; -} else { - $filename_avg = $dir.'/ticketsaverage-'.$year.'.png'; - $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=ticketstats&file=ticketsaverage-'.$year.'.png'; -} - -$px3 = new DolGraph(); -$mesg = $px3->isGraphKo(); -if (!$mesg) { - $px3->SetData($data); - $i = $startyear; $legend = array(); - while ($i <= $endyear) { - $legend[] = $i; - $i++; - } - $px3->SetLegend($legend); - $px3->SetYLabel($langs->trans("AmountAverage")); - $px3->SetMaxValue($px3->GetCeilMaxValue()); - $px3->SetMinValue($px3->GetFloorMinValue()); - $px3->SetWidth($WIDTH); - $px3->SetHeight($HEIGHT); - $px3->SetShading(3); - $px3->SetHorizTickIncrement(1); - $px3->mode = 'depth'; - $px3->SetTitle($langs->trans("AmountAverage")); - - $px3->draw($filename_avg, $fileurl_avg); -}*/ - - - // Show array $data = $stats->getAllByYear(); $arrayyears = array(); diff --git a/htdocs/user/bank.php b/htdocs/user/bank.php index 76177649c10..ca663c38448 100644 --- a/htdocs/user/bank.php +++ b/htdocs/user/bank.php @@ -85,11 +85,11 @@ if (empty($account->userid)) { // Define value to know what current user can do on users $canadduser = (!empty($user->admin) || $user->hasRight('user', 'user', 'creer') || $user->rights->hrm->write_personal_information->write); $canreaduser = (!empty($user->admin) || $user->rights->user->user->lire || $user->rights->hrm->read_personal_information->read); -$permissiontoaddbankaccount = (!empty($user->rights->salaries->write) || !empty($user->rights->hrm->employee->write) || $user->hasRight('user', 'creer')); +$permissiontoaddbankaccount = ($user->hasRight('salaries', 'write') || $user->hasRight('hrm', 'employee', 'write') || $user->hasRight('user', 'creer')); $permissiontoreadhr = $user->hasRight('hrm', 'read_personal_information', 'read') || $user->hasRight('hrm', 'write_personal_information', 'write'); $permissiontowritehr = $user->hasRight('hrm', 'write_personal_information', 'write'); -// Ok if user->rights->salaries->read or user->rights->hrm->read +// Ok if user->hasRight('salaries', 'read') or user->hasRight('hrm', 'read') //$result = restrictedArea($user, 'salaries|hrm', $object->id, 'user&user', $feature2); $ok = false; if ($user->id == $id) { diff --git a/htdocs/user/class/api_users.class.php b/htdocs/user/class/api_users.class.php index ea2c9bb3cea..d2f406442b2 100644 --- a/htdocs/user/class/api_users.class.php +++ b/htdocs/user/class/api_users.class.php @@ -148,7 +148,7 @@ class Users extends DolibarrApi */ public function get($id, $includepermissions = 0) { - if (empty(DolibarrApiAccess::$user->rights->user->user->lire) && empty(DolibarrApiAccess::$user->admin) && $id != 0 && DolibarrApiAccess::$user->id != $id) { + if (!DolibarrApiAccess::$user->hasRight('user', 'user', 'lire') && empty(DolibarrApiAccess::$user->admin) && $id != 0 && DolibarrApiAccess::$user->id != $id) { throw new RestException(401, 'Not allowed'); } @@ -191,7 +191,7 @@ class Users extends DolibarrApi throw new RestException(400, 'Bad parameters'); } - if (empty(DolibarrApiAccess::$user->rights->user->user->lire) && empty(DolibarrApiAccess::$user->admin) && DolibarrApiAccess::$user->login != $login) { + if (!DolibarrApiAccess::$user->hasRight('user', 'user', 'lire') && empty(DolibarrApiAccess::$user->admin) && DolibarrApiAccess::$user->login != $login) { throw new RestException(401, 'Not allowed'); } @@ -230,7 +230,7 @@ class Users extends DolibarrApi throw new RestException(400, 'Bad parameters'); } - if (empty(DolibarrApiAccess::$user->rights->user->user->lire) && empty(DolibarrApiAccess::$user->admin) && DolibarrApiAccess::$user->email != $email) { + if (!DolibarrApiAccess::$user->hasRight('user', 'user', 'lire') && empty(DolibarrApiAccess::$user->admin) && DolibarrApiAccess::$user->email != $email) { throw new RestException(401, 'Not allowed'); } @@ -263,7 +263,7 @@ class Users extends DolibarrApi */ public function getInfo($includepermissions = 0) { - if (empty(DolibarrApiAccess::$user->rights->user->self->creer) && empty(DolibarrApiAccess::$user->rights->user->user->lire) && empty(DolibarrApiAccess::$user->admin)) { + if (!DolibarrApiAccess::$user->hasRights('user', 'self', 'creer') && !DolibarrApiAccess::$user->hasRight('user', 'user', 'lire') && empty(DolibarrApiAccess::$user->admin)) { throw new RestException(401, 'Not allowed'); } @@ -304,7 +304,7 @@ class Users extends DolibarrApi public function post($request_data = null) { // Check user authorization - if (empty(DolibarrApiAccess::$user->rights->user->creer) && empty(DolibarrApiAccess::$user->admin)) { + if (!DolibarrApiAccess::$user->hasRight('user', 'creer') && empty(DolibarrApiAccess::$user->admin)) { throw new RestException(401, "User creation not allowed for login ".DolibarrApiAccess::$user->login); } @@ -328,7 +328,7 @@ class Users extends DolibarrApi continue; } /*if ($field == 'pass') { - if (empty(DolibarrApiAccess::$user->rights->user->user->password)) { + if (!DolibarrApiAccess::$user->hasRight('user', 'user', 'password')) { throw new RestException(401, 'You are not allowed to modify/set password of other users'); continue; } @@ -381,10 +381,10 @@ class Users extends DolibarrApi continue; } if ($field == 'pass') { - if ($this->useraccount->id != DolibarrApiAccess::$user->id && empty(DolibarrApiAccess::$user->rights->user->user->password)) { + if ($this->useraccount->id != DolibarrApiAccess::$user->id && !DolibarrApiAccess::$user->hasRight('user', 'user', 'password')) { throw new RestException(401, 'You are not allowed to modify password of other users'); } - if ($this->useraccount->id == DolibarrApiAccess::$user->id && empty(DolibarrApiAccess::$user->rights->user->self->password)) { + if ($this->useraccount->id == DolibarrApiAccess::$user->id && !DolibarrApiAccess::$user->hasRight('user', 'self', 'password')) { throw new RestException(401, 'You are not allowed to modify your own password'); } } @@ -442,7 +442,7 @@ class Users extends DolibarrApi */ public function getGroups($id) { - if (empty(DolibarrApiAccess::$user->rights->user->user->lire) && empty(DolibarrApiAccess::$user->admin)) { + if (!DolibarrApiAccess::$user->hasRight('user', 'user', 'lire') && empty(DolibarrApiAccess::$user->admin)) { throw new RestException(403); } @@ -537,8 +537,8 @@ class Users extends DolibarrApi $obj_ret = array(); - if ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && empty(DolibarrApiAccess::$user->rights->user->user->lire) && empty(DolibarrApiAccess::$user->admin)) || - getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && empty(DolibarrApiAccess::$user->rights->user->group_advance->read) && empty(DolibarrApiAccess::$user->admin)) { + if ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !DolibarrApiAccess::$user->hasRight('user', 'user', 'lire') && empty(DolibarrApiAccess::$user->admin)) || + getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !DolibarrApiAccess::$user->hasRight('user', 'group_advance', 'read') && empty(DolibarrApiAccess::$user->admin)) { throw new RestException(403, "You are not allowed to read groups"); } @@ -609,8 +609,8 @@ class Users extends DolibarrApi { global $db, $conf; - if ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && empty(DolibarrApiAccess::$user->rights->user->user->lire) && empty(DolibarrApiAccess::$user->admin)) || - getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && empty(DolibarrApiAccess::$user->rights->user->group_advance->read) && empty(DolibarrApiAccess::$user->admin)) { + if ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !DolibarrApiAccess::$user->hasRight('user', 'user', 'lire') && empty(DolibarrApiAccess::$user->admin)) || + getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !DolibarrApiAccess::$user->hasRight('user', 'group_advance', 'read') && empty(DolibarrApiAccess::$user->admin)) { throw new RestException(403, "You are not allowed to read groups"); } @@ -635,7 +635,7 @@ class Users extends DolibarrApi */ public function delete($id) { - if (empty(DolibarrApiAccess::$user->rights->user->user->supprimer) && empty(DolibarrApiAccess::$user->admin)) { + if (!DolibarrApiAccess::$user->hasRight('user', 'user', 'supprimer') && empty(DolibarrApiAccess::$user->admin)) { throw new RestException(403, 'Not allowed'); } $result = $this->useraccount->fetch($id); @@ -708,7 +708,7 @@ class Users extends DolibarrApi unset($object->lines); unset($object->model_pdf); - $canreadsalary = ((isModEnabled('salaries') && !empty(DolibarrApiAccess::$user->rights->salaries->read)) || (empty($conf->salaries->enabled))); + $canreadsalary = ((isModEnabled('salaries') && DolibarrApiAccess::$user->hasRight('salaries', 'read')) || !isModEnabled('salaries')); if (!$canreadsalary) { unset($object->salary); diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 7b59b1f4375..b32fae3e182 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -789,7 +789,7 @@ class User extends CommonObject } $moduleRightsMapping = array( - 'product' => 'produit', // We must check $user->rights->produit... + 'product' => 'produit', 'margin' => 'margins', 'comptabilite' => 'compta' ); @@ -799,7 +799,7 @@ class User extends CommonObject $rightsPath = $moduleRightsMapping[$rightsPath]; } - // If module is abc@module, we check permission user->rights->module->abc->permlevel1 + // If module is abc@module, we check permission user->hasRight(module, abc, permlevel1) $tmp = explode('@', $rightsPath, 2); if (!empty($tmp[1])) { if (strpos($module, '@') !== false) { diff --git a/htdocs/user/group/ldap.php b/htdocs/user/group/ldap.php index 8eb400ad793..34aba0173b2 100644 --- a/htdocs/user/group/ldap.php +++ b/htdocs/user/group/ldap.php @@ -53,7 +53,7 @@ if (isModEnabled('multicompany') && $conf->entity > 1 && getDolGlobalString('MUL $canreadperms = true; if (getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) { - $canreadperms = (!empty($user->admin) || !empty($user->rights->user->group_advance->read)); + $canreadperms = (!empty($user->admin) || $user->hasRight('user', 'group_advance', 'read')); } diff --git a/htdocs/user/notify/card.php b/htdocs/user/notify/card.php index 37e8e780067..5e5aa095c1a 100644 --- a/htdocs/user/notify/card.php +++ b/htdocs/user/notify/card.php @@ -71,7 +71,7 @@ if ($id > 0 || !empty($ref)) { $object->getrights(); } -$permissiontoadd = (($object->id == $user->id) || (!empty($user->rights->user->user->lire))); +$permissiontoadd = (($object->id == $user->id) || ($user->hasRight('user', 'user', 'lire'))); // Security check if ($user->socid) { diff --git a/htdocs/user/virtualcard.php b/htdocs/user/virtualcard.php index adc174ff53e..b0e54d3153e 100644 --- a/htdocs/user/virtualcard.php +++ b/htdocs/user/virtualcard.php @@ -122,8 +122,6 @@ $morehtmlref .= '</a>'; $urltovirtualcard = '/user/virtualcard.php?id='.((int) $object->id); $morehtmlref .= dolButtonToOpenUrlInDialogPopup('publicvirtualcard', $langs->transnoentitiesnoconv("PublicVirtualCardUrl").' - '.$object->getFullName($langs), img_picto($langs->trans("PublicVirtualCardUrl"), 'card', 'class="valignmiddle marginleftonly paddingrightonly"'), $urltovirtualcard, '', 'nohover'); -//dol_banner_tab($object, 'id', $linkback, $user->rights->user->user->lire || $user->admin, 'rowid', 'ref', $morehtmlref); - print '<div class="fichecenter">'; diff --git a/htdocs/variants/card.php b/htdocs/variants/card.php index da822702c22..501a209ad5f 100644 --- a/htdocs/variants/card.php +++ b/htdocs/variants/card.php @@ -59,10 +59,10 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be includ // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('productattributecard', 'globalcard')); -$permissiontoread = $user->rights->variants->read; -$permissiontoadd = $user->rights->variants->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php -$permissiontoedit = $user->rights->variants->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php -$permissiontodelete = $user->rights->variants->delete; +$permissiontoread = $user->hasRight('variants', 'read'); +$permissiontoadd = $user->hasRight('variants', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php +$permissiontoedit = $user->hasRight('variants', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php +$permissiontodelete = $user->hasRight('variants', 'delete'); $error = 0; diff --git a/htdocs/variants/combinations.php b/htdocs/variants/combinations.php index 61f8822836c..83449b1fccb 100644 --- a/htdocs/variants/combinations.php +++ b/htdocs/variants/combinations.php @@ -90,9 +90,9 @@ if ($object->id > 0) { } else { restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype); } -$usercanread = (($object->type == Product::TYPE_PRODUCT && $user->rights->produit->lire) || ($object->type == Product::TYPE_SERVICE && $user->hasRight('service', 'lire'))); -$usercancreate = (($object->type == Product::TYPE_PRODUCT && $user->rights->produit->creer) || ($object->type == Product::TYPE_SERVICE && $user->hasRight('service', 'creer'))); -$usercandelete = (($object->type == Product::TYPE_PRODUCT && $user->rights->produit->supprimer) || ($object->type == Product::TYPE_SERVICE && $user->rights->service->supprimer)); +$usercanread = (($object->type == Product::TYPE_PRODUCT && $user->hasRight('produit', 'lire')) || ($object->type == Product::TYPE_SERVICE && $user->hasRight('service', 'lire'))); +$usercancreate = (($object->type == Product::TYPE_PRODUCT && $user->hasRight('produit', 'creer')) || ($object->type == Product::TYPE_SERVICE && $user->hasRight('service', 'creer'))); +$usercandelete = (($object->type == Product::TYPE_PRODUCT && $user->hasRight('produit', 'supprimer')) || ($object->type == Product::TYPE_SERVICE && $user->hasRight('service', 'supprimer'))); /* @@ -861,15 +861,6 @@ if (!empty($id) || !empty($ref)) { print '<input type="hidden" name="backtopage" value="'.$backtopage.'">'; // List of mass actions available - /* - $arrayofmassactions = array( - 'presend'=>$langs->trans("SendByMail"), - 'builddoc'=>$langs->trans("PDFMerge"), - ); - if ($user->rights->product->supprimer) $arrayofmassactions['predelete']='<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete"); - if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); - $massactionbutton=$form->selectMassAction('', $arrayofmassactions); - */ $aaa = ''; if (count($productCombinations)) { diff --git a/htdocs/variants/tpl/productattributevalueline_title.tpl.php b/htdocs/variants/tpl/productattributevalueline_title.tpl.php index 7a2625170fe..b2905b535f2 100644 --- a/htdocs/variants/tpl/productattributevalueline_title.tpl.php +++ b/htdocs/variants/tpl/productattributevalueline_title.tpl.php @@ -18,8 +18,8 @@ * $object (invoice, order, ...) * $conf * $langs - * $element (used to test $user->rights->$element->creer) - * $permtoedit (used to replace test $user->rights->$element->creer) + * $element (used to test $user->hasRight('element', 'creer')) + * $permtoedit (used to replace test $user->hasright('element', 'creer')) * $inputalsopricewithtax (0 by default, 1 to also show column with unit price including tax) * $outputalsopricetotalwithtax * $usemargins (0 to disable all margins columns, 1 to show according to margin setup) diff --git a/htdocs/variants/tpl/productattributevalueline_view.tpl.php b/htdocs/variants/tpl/productattributevalueline_view.tpl.php index 419038be5fb..1a43e884d06 100644 --- a/htdocs/variants/tpl/productattributevalueline_view.tpl.php +++ b/htdocs/variants/tpl/productattributevalueline_view.tpl.php @@ -20,8 +20,8 @@ * $langs * $dateSelector * $forceall (0 by default, 1 for supplier invoices/orders) - * $element (used to test $user->rights->$element->creer) - * $permtoedit (used to replace test $user->rights->$element->creer) + * $element (used to test $user->hasRight($element, 'creer')) + * $permtoedit (used to replace test $user->hasRight($element, 'creer')) * $senderissupplier (0 by default, 1 for supplier invoices/orders) * $inputalsopricewithtax (0 by default, 1 to also show column with unit price including tax) * $outputalsopricetotalwithtax diff --git a/htdocs/webhook/class/target.class.php b/htdocs/webhook/class/target.class.php index c5dbafc3183..9049a53e7fb 100644 --- a/htdocs/webhook/class/target.class.php +++ b/htdocs/webhook/class/target.class.php @@ -188,12 +188,6 @@ class Target extends CommonObject $this->fields['entity']['enabled'] = 0; } - // Example to show how to set values of fields definition dynamically - /*if ($user->rights->webhook->target->read) { - $this->fields['myfield']['visible'] = 1; - $this->fields['myfield']['noteditable'] = 0; - }*/ - // Unset fields that are disabled foreach ($this->fields as $key => $val) { if (isset($val['enabled']) && empty($val['enabled'])) { @@ -506,14 +500,6 @@ class Target extends CommonObject return 0; } - /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->webhook->target->write)) - || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->webhook->target->target_advance->validate)))) - { - $this->error='NotEnoughPermissions'; - dol_syslog(get_class($this)."::valid ".$this->error, LOG_ERR); - return -1; - }*/ - $now = dol_now(); $this->db->begin(); @@ -632,13 +618,6 @@ class Target extends CommonObject return 0; } - /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->webhook->write)) - || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->webhook->webhook_advance->validate)))) - { - $this->error='Permission denied'; - return -1; - }*/ - return $this->setStatusCommon($user, self::STATUS_DRAFT, $notrigger, 'TARGET_UNVALIDATE'); } @@ -656,13 +635,6 @@ class Target extends CommonObject return 0; } - /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->webhook->write)) - || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->webhook->webhook_advance->validate)))) - { - $this->error='Permission denied'; - return -1; - }*/ - return $this->setStatusCommon($user, self::STATUS_CANCELED, $notrigger, 'TARGET_CANCEL'); } @@ -680,13 +652,6 @@ class Target extends CommonObject return 0; } - /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->webhook->write)) - || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->webhook->webhook_advance->validate)))) - { - $this->error='Permission denied'; - return -1; - }*/ - return $this->setStatusCommon($user, self::STATUS_VALIDATED, $notrigger, 'TARGET_REOPEN'); } diff --git a/htdocs/webportal/class/context.class.php b/htdocs/webportal/class/context.class.php index 10fb12e5641..d590c4fcf6d 100644 --- a/htdocs/webportal/class/context.class.php +++ b/htdocs/webportal/class/context.class.php @@ -243,8 +243,8 @@ class Context global $conf; // Init de l'url de base - if (!empty($conf->global->WEBPORTAL_ROOT_URL)) { - $rootUrl = $conf->global->WEBPORTAL_ROOT_URL; + if (getDolGlobalString('WEBPORTAL_ROOT_URL')) { + $rootUrl = getDolGlobalString('WEBPORTAL_ROOT_URL'); if (substr($rootUrl, -1) !== '/') { $rootUrl .= '/'; } diff --git a/htdocs/webportal/class/html.formwebportal.class.php b/htdocs/webportal/class/html.formwebportal.class.php index 863e4ba20c6..42f2e9fd305 100644 --- a/htdocs/webportal/class/html.formwebportal.class.php +++ b/htdocs/webportal/class/html.formwebportal.class.php @@ -273,7 +273,7 @@ class FormWebPortal extends Form } // Get list of files starting with name of ref (Note: files with '^ref\.extension' are generated files, files with '^ref-...' are uploaded files) - if ($allfiles || !empty($conf->global->MAIN_SHOW_ALL_FILES_ON_DOCUMENT_TOOLTIP)) { + if ($allfiles || getDolGlobalString('MAIN_SHOW_ALL_FILES_ON_DOCUMENT_TOOLTIP')) { $filterforfilesearch = '^' . preg_quote(basename($modulesubdir), '/'); } else { $filterforfilesearch = '^' . preg_quote(basename($modulesubdir), '/') . '\.'; diff --git a/htdocs/webportal/class/webPortalTheme.class.php b/htdocs/webportal/class/webPortalTheme.class.php index f4c87331dcf..4adfcb402c0 100644 --- a/htdocs/webportal/class/webPortalTheme.class.php +++ b/htdocs/webportal/class/webPortalTheme.class.php @@ -80,9 +80,9 @@ class WebPortalTheme $outColor = ''; - if (!empty($conf->global->WEBPORTAL_PRIMARY_COLOR)) { - $outColor = $conf->global->WEBPORTAL_PRIMARY_COLOR; - } elseif (!empty($conf->global->THEME_ELDY_TOPMENU_BACK1)) { + if (getDolGlobalString('WEBPORTAL_PRIMARY_COLOR')) { + $outColor = getDolGlobalString('WEBPORTAL_PRIMARY_COLOR'); + } elseif (getDolGlobalString('THEME_ELDY_TOPMENU_BACK1')) { $outColor = '#' . colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1)); } diff --git a/htdocs/webportal/class/webportalmember.class.php b/htdocs/webportal/class/webportalmember.class.php index 89165eaf2ed..7ef93ac9f35 100644 --- a/htdocs/webportal/class/webportalmember.class.php +++ b/htdocs/webportal/class/webportalmember.class.php @@ -224,7 +224,7 @@ class WebPortalMember extends Adherent $datas = []; if (getDolGlobalInt('MAIN_OPTIMIZEFORTEXTBROWSER')) { - return ['optimize' => $langs->trans("ShowWebPortalMember")]; + return ['optimize' => $langs->trans("WebPortalMember")]; } $datas['picto'] = img_picto('', $this->picto) . ' <u>' . $langs->trans("WebPortalMember") . '</u>'; if (isset($this->status)) { @@ -252,7 +252,7 @@ class WebPortalMember extends Adherent { global $conf, $langs, $hookmanager; - if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && $withpictoimg) { + if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER') && $withpictoimg) { $withpictoimg = 0; } @@ -297,7 +297,7 @@ class WebPortalMember extends Adherent $linkstart .= '<a href="' . $url . '"'; $linkclose = ""; if (empty($notooltip)) { - if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { + if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { $langs->load("users"); $label = $langs->trans("ShowUser"); $linkclose .= ' alt="' . dol_escape_htmltag($label, 1) . '"'; @@ -335,7 +335,7 @@ class WebPortalMember extends Adherent $result .= $picto; } if (($withpictoimg > -2 && $withpictoimg != 2) || $withpictoimg == -4) { - if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { + if (!getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { $result .= '<span class="nopadding valignmiddle' . ((!isset($this->statut) || $this->statut) ? '' : ' strikefordisabled') . ($morecss ? ' usertext' . $morecss : '') . '">'; } @@ -346,7 +346,7 @@ class WebPortalMember extends Adherent } else { $result .= $this->getFullName($langs, '', ($mode == 'firstname' ? 2 : ($mode == 'lastname' ? 4 : -1)), $maxlen); } - if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { + if (!getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { $result .= '</span>'; } } @@ -435,8 +435,8 @@ class WebPortalMember extends Adherent // List of extra languages $arrayoflangcode = array(); - if (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE)) { - $arrayoflangcode[] = $conf->global->PDF_USE_ALSO_LANGUAGE_CODE; + if (getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE')) { + $arrayoflangcode[] = getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE'); } if (is_array($arrayoflangcode) && count($arrayoflangcode)) { @@ -466,9 +466,9 @@ class WebPortalMember extends Adherent } // If MAIN_FORCE_STATE_INTO_ADDRESS is on, state is already returned previously with getFullAddress - if (!in_array($this->country_code, $countriesusingstate) && empty($conf->global->MAIN_FORCE_STATE_INTO_ADDRESS) - && empty($conf->global->SOCIETE_DISABLE_STATE) && $this->state) { - if (!empty($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT) && $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 1 && $this->region) { + if (!in_array($this->country_code, $countriesusingstate) && !getDolGlobalString('MAIN_FORCE_STATE_INTO_ADDRESS') + && !getDolGlobalString('SOCIETE_DISABLE_STATE') && $this->state) { + if (getDolGlobalInt('MAIN_SHOW_REGION_IN_STATE_SELECT') == 1 && $this->region) { $out .= ($outdone ? ' - ' : '') . $this->region . ' - ' . $this->state; } else { $out .= ($outdone ? ' - ' : '') . $this->state; diff --git a/htdocs/webportal/class/webportalorder.class.php b/htdocs/webportal/class/webportalorder.class.php index 7cf96715b96..12b1586e4c3 100644 --- a/htdocs/webportal/class/webportalorder.class.php +++ b/htdocs/webportal/class/webportalorder.class.php @@ -169,7 +169,7 @@ class WebPortalOrder extends Commande $datas = []; if (getDolGlobalInt('MAIN_OPTIMIZEFORTEXTBROWSER')) { - return ['optimize' => $langs->trans("ShowWebPortalOrder")]; + return ['optimize' => $langs->trans("WebPortalOrder")]; } $datas['picto'] = img_picto('', $this->picto) . ' <u>' . $langs->trans("WebPortalOrder") . '</u>'; if (isset($this->status)) { diff --git a/htdocs/webportal/class/webportalpartnership.class.php b/htdocs/webportal/class/webportalpartnership.class.php index 884bdf3a57d..9a83db0bf59 100644 --- a/htdocs/webportal/class/webportalpartnership.class.php +++ b/htdocs/webportal/class/webportalpartnership.class.php @@ -202,7 +202,7 @@ class WebPortalPartnership extends Partnership $datas = []; if (getDolGlobalInt('MAIN_OPTIMIZEFORTEXTBROWSER')) { - return ['optimize' => $langs->trans("ShowWebPortalPartnership")]; + return ['optimize' => $langs->trans("WebPortalPartnership")]; } $datas['picto'] = img_picto('', $this->picto) . ' <u>' . $langs->trans("WebPortalPartnership") . '</u>'; if (isset($this->status)) { @@ -265,7 +265,7 @@ class WebPortalPartnership extends Partnership $linkclose = ''; if (empty($notooltip)) { - if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { + if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { $label = $langs->trans("ShowPartnership"); $linkclose .= ' alt="' . dol_escape_htmltag($label, 1) . '"'; } diff --git a/htdocs/webportal/class/webportalpropal.class.php b/htdocs/webportal/class/webportalpropal.class.php index 03bef3664d1..d53fa5f07ab 100644 --- a/htdocs/webportal/class/webportalpropal.class.php +++ b/htdocs/webportal/class/webportalpropal.class.php @@ -169,7 +169,7 @@ class WebPortalPropal extends Propal $datas = []; if (getDolGlobalInt('MAIN_OPTIMIZEFORTEXTBROWSER')) { - return ['optimize' => $langs->trans("ShowWebPortalPropal")]; + return ['optimize' => $langs->trans("WebPortalPropal")]; } $datas['picto'] = img_picto('', $this->picto) . ' <u>' . $langs->trans("WebPortalPropal") . '</u>'; if (isset($this->status)) { diff --git a/htdocs/webportal/controllers/document.controller.class.php b/htdocs/webportal/controllers/document.controller.class.php index dbaf007c6b3..104f2a5025d 100644 --- a/htdocs/webportal/controllers/document.controller.class.php +++ b/htdocs/webportal/controllers/document.controller.class.php @@ -111,7 +111,7 @@ class DocumentController extends Controller if (isset($_GET["attachment"])) { $attachment = GETPOST("attachment", 'alpha') ? true : false; } - if (!empty($conf->global->MAIN_DISABLE_FORCE_SAVEAS)) { + if (getDolGlobalString('MAIN_DISABLE_FORCE_SAVEAS')) { $attachment = false; } diff --git a/htdocs/website/index.php b/htdocs/website/index.php index ac3c6bd4c44..557eca88bc2 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -347,8 +347,8 @@ if ($action == 'replacesite' || $mode == 'replacesite') { $listofpages = getPagesFromSearchCriterias($containertype, $algo, $searchkey, 1000, $sortfield, $sortorder, $langcode, $otherfilters, -1); } -$usercanedit = $user->rights->website->write; -$permissiontoadd = $user->rights->website->write; // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles +$usercanedit = $user->hasRight('website', 'write'); +$permissiontoadd = $user->hasRight('website', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles $permissiontodelete = $user->hasRight('website', 'delete'); diff --git a/htdocs/website/websiteaccount_card.php b/htdocs/website/websiteaccount_card.php index b80d6a6fdb7..cad85f13628 100644 --- a/htdocs/website/websiteaccount_card.php +++ b/htdocs/website/websiteaccount_card.php @@ -404,20 +404,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print dolGetButtonAction('', $langs->trans('ToClone'), 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.(!empty($object->socid) ? '&socid='.$object->socid : '').'&action=clone&token='.newToken(), '', $permissiontoadd); } - /* - if ($user->rights->sellyoursaas->create) - { - if ($object->status == 1) - { - print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=disable&token='.newToken().'">'.$langs->trans("Disable").'</a></div>'."\n"; - } - else - { - print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=enable&token='.newToken().'">'.$langs->trans("Enable").'</a></div>'."\n"; - } - } - */ - // Delete $params = array(); print dolGetButtonAction('', $langs->trans("Delete"), 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $permissiontodelete, $params); diff --git a/htdocs/workstation/workstation_document.php b/htdocs/workstation/workstation_document.php index 4510cd39023..5dba65f6776 100644 --- a/htdocs/workstation/workstation_document.php +++ b/htdocs/workstation/workstation_document.php @@ -184,12 +184,7 @@ if ($object->id) { print dol_get_fiche_end(); $modulepart = 'workstation'; - //$permission = $user->rights->workstation->workstation->write; - $permission = 1; - //$permtoedit = $user->rights->workstation->workstation->write; - $permtoedit = 1; $param = '&id='.$object->id; - //$relativepathwithnofile='workstation/' . dol_sanitizeFileName($object->id).'/'; $relativepathwithnofile = 'workstation/'.dol_sanitizeFileName($object->ref).'/'; diff --git a/htdocs/workstation/workstation_note.php b/htdocs/workstation/workstation_note.php index 59085e64cbe..8f16aca5b3f 100644 --- a/htdocs/workstation/workstation_note.php +++ b/htdocs/workstation/workstation_note.php @@ -56,8 +56,8 @@ if ($id > 0 || !empty($ref)) { $upload_dir = $conf->workstation->multidir_output[$object->entity]."/".$object->id; } -$permissionnote = $user->rights->workstation->workstation->write; // Used by the include of actions_setnotes.inc.php -$permissiontoadd = $user->rights->workstation->workstation->write; // Used by the include of actions_addupdatedelete.inc.php +$permissionnote = $user->hasRight('workstation', 'workstation', 'write'); // Used by the include of actions_setnotes.inc.php +$permissiontoadd = $user->hasRight('workstation', 'workstation', 'write'); // Used by the include of actions_addupdatedelete.inc.php // Security check $isdraft = 0; diff --git a/htdocs/zapier/class/api_zapier.class.php b/htdocs/zapier/class/api_zapier.class.php index 5ad9cc9cb5a..30ab25c938d 100644 --- a/htdocs/zapier/class/api_zapier.class.php +++ b/htdocs/zapier/class/api_zapier.class.php @@ -75,7 +75,7 @@ class Zapier extends DolibarrApi */ public function get($id) { - if (!DolibarrApiAccess::$user->rights->zapier->read) { + if (!DolibarrApiAccess::$user->hasRight('zapier', 'read')) { throw new RestException(403); } @@ -103,7 +103,7 @@ class Zapier extends DolibarrApi */ public function getModulesChoices() { - if (!DolibarrApiAccess::$user->rights->zapier->read) { + if (!DolibarrApiAccess::$user->hasRight('zapier', 'read')) { throw new RestException(403); } @@ -145,7 +145,7 @@ class Zapier extends DolibarrApi */ public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '', $properties = '') { - if (!DolibarrApiAccess::$user->rights->zapier->read) { + if (!DolibarrApiAccess::$user->hasRight('zapier', 'read')) { throw new RestException(403); } @@ -158,7 +158,7 @@ class Zapier extends DolibarrApi // If the internal user must only see his customers, force searching by him $search_sale = 0; - if ($restrictonsocid && !DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) { + if ($restrictonsocid && !DolibarrApiAccess::$user->hasRight('societe', 'client', 'voir') && !$socid) { $search_sale = DolibarrApiAccess::$user->id; } @@ -227,7 +227,7 @@ class Zapier extends DolibarrApi */ public function post($request_data = null) { - if (!DolibarrApiAccess::$user->rights->zapier->write) { + if (!DolibarrApiAccess::$user->hasRight('zapier', 'write')) { throw new RestException(403); } @@ -270,7 +270,7 @@ class Zapier extends DolibarrApi // */ /*public function put($id, $request_data = null) { - if (! DolibarrApiAccess::$user->rights->zapier->write) { + if (! DolibarrApiAccess::$user->hasRight('zapier', 'write')) { throw new RestException(403); } @@ -307,7 +307,7 @@ class Zapier extends DolibarrApi */ public function delete($id) { - if (!DolibarrApiAccess::$user->rights->zapier->delete) { + if (!DolibarrApiAccess::$user->hasRight('zapier', 'delete')) { throw new RestException(403); }