Fix #28071 - New branch to fix bad merge (#28083)

* Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

* Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into
develop

* Qual: Introduce getDataToShowPhoto to prepare generic code

* Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

* Fix missing trans

* Fix langs

* Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

* Remove useless files in web templates

* Clean code

* Fix duplicate translation key

* Fix duplicate translation key

* Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

* Fix duplicate key

* Fix $object

* Debug v19

* WIP SMSing

* Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

* WIP EMAILINGS_SUPPORT_ALSO_SMS

* Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

* Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

* WIP SMSing

* Debug the "validate" feature

* Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

* Clean code

* Move rights->x->y into hasRight('x', 'y')

* Move rights->x->y into hasRight('x', 'y')

* Move rights->x->y into hasRight('x', 'y')

* Move rights->x->y into hasRight('x', 'y')

* Move rights->x->y into hasRight('x', 'y')

* Move rights->x->y into hasRight('x', 'y')

* Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

* Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into
develop

* Enhance rector to fix empty($user->rights->modulex->perm1)

* Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into
develop

* Fix template to use v19 dev rules

* Fix use v19 dev rules

* Fix phpunit

* Debug v19

* Clean code

* Use rector to convert user->rights into user->hasRight

* Clean code

* Use rector to convert user->rights into user->hasRight

* Use rector to convert user->rights into user->hasRight

* Clean code

* Fix phpcs

* add editorconfig for sql files (#27999)

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>

* add model_pdf field in llx_ticket-ticket.sql (#27996)

* add model_pdf field in llx_ticket-ticket.sql

* Update 19.0.0-20.0.0.sql

* Update 19.0.0-20.0.0.sql

* Improve wording in README (#27994)

* fix phpstan (#27989)

* fix phpstan

* Update UserRightsToFunction.php

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>

* Qual: Fix spelling/working in datapolicy translations (#28006)

# Qual: Fix spelling/wording in datapolicy translations

Fixed some spelling and wording in datapolicy translations.

* qual: phpstan for htdocs/ticket/class/ticketstats.class.php (#27986)

htdocs/ticket/class/ticketstats.class.php	98	Parameter #1 $year (string) of method TicketStats::getNbByMonth() should be compatible with parameter $year (int) of method Stats::getNbByMonth()

* Merge branch '19.0' of git@github.com:Dolibarr/dolibarr.git into develop

* Fix user with readonly perm on email template must be able to read.

* Fix doc

* Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

* Better message

* Add missing fields in merge of thirdparty

* Debug v19 selection of ticket printer per terminal

* Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

* Use constant

* NEW: Adding a recipient on emails sent, change status to sent partialy.

* fix travis (#28052)

* fix travis

* Update partnership.class.php

* fix php doc (#28047)

* fix undefined array key (#28048)

* Add region and departament for Cuba (#28046)

* Update llx_10_c_regions.sql

Add Cuba Regions (id_country=77)

* Update llx_20_c_departements.sql

Add Provinces Cuba (id country=77)

* Find the typo (#28050)

* Find the typo

* clean code

* add last_main_doc field to product (#28045)

* add las_main_doc field to product

* add field fetch

* NEW Add Categorie filter for ActionComm (#28041)

* New Add Categorie filter for ActionComm

New Add Categorie filter for ActionComm

* Fix space errors

Fix space errors

* Fix space errors 2

Fix space errors 2

* Update cunits.class.php (#28056)

FIX: error SQL when creating a Cunit

* Update codespell-lines-ignore.txt to avoid PR merge conflict

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
Co-authored-by: Frédéric FRANCE <frederic34@users.noreply.github.com>
Co-authored-by: thibdrev <thibault.drevet@gmail.com>
Co-authored-by: sonikf <93765174+sonikf@users.noreply.github.com>
Co-authored-by: Ikarus <44511582+LeKarSol@users.noreply.github.com>
Co-authored-by: Anthony Damhet <73399671+EchoLoGeek@users.noreply.github.com>
Co-authored-by: Quentin-Seekness <72733832+Quentin-Seekness@users.noreply.github.com>
This commit is contained in:
MDW 2024-02-09 15:58:49 +01:00 committed by GitHub
parent 275dbca5fa
commit 7b54824d49
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
523 changed files with 2895 additions and 7653 deletions

View File

@ -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

145
ChangeLog
View File

@ -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

View File

@ -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:

View File

@ -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/
```

View File

@ -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

View File

@ -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;
}

View File

@ -0,0 +1,283 @@
<?php
namespace Dolibarr\Rector\Renaming;
use PhpParser\Node;
use PhpParser\Node\Arg;
use PhpParser\Node\Expr\ArrayDimFetch;
use PhpParser\Node\Expr\BinaryOp\BooleanAnd;
use PhpParser\Node\Expr\BinaryOp\Concat;
use PhpParser\Node\Expr\BinaryOp\Equal;
use PhpParser\Node\Expr\BooleanNot;
use PhpParser\Node\Expr\Empty_;
use PhpParser\Node\Expr\FuncCall;
use PhpParser\Node\Expr\Isset_;
use PhpParser\Node\Expr\PropertyFetch;
use PhpParser\Node\Name;
use PhpParser\Node\Scalar\String_;
use Rector\Core\NodeManipulator\BinaryOpManipulator;
use Rector\Core\Rector\AbstractRector;
use Rector\Php71\ValueObject\TwoNodeMatch;
use Symplify\RuleDocGenerator\Exception\PoorDocumentationException;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
use Rector\Strict\Rector\BooleanNot\BooleanInBooleanNotRuleFixerRector;
/**
* Class with Rector custom rule to fix code
*/
class EmptyUserRightsToFunction extends AbstractRector
{
/**
* @var \Rector\Core\NodeManipulator\BinaryOpManipulator
*/
private $binaryOpManipulator;
/**
* Constructor
*
* @param BinaryOpManipulator $binaryOpManipulator The $binaryOpManipulator
*/
public function __construct(BinaryOpManipulator $binaryOpManipulator)
{
$this->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');
}
}

View File

@ -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;
}

View File

@ -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;
}
);
}
}

1
htdocs/.gitignore vendored
View File

@ -1,3 +1,4 @@
/aaa*
/allscreens*
/ancot*
/bootstrap*

View File

@ -374,7 +374,7 @@ if (getDolGlobalInt('ACCOUNTING_MANAGE_ZERO')) {
}
print '</tr>';
// Param a user $user->rights->accounting->chartofaccount can access
// Param a user $user->hasRights('accounting', 'chartofaccount') can access
foreach ($list as $key) {
print '<tr class="oddeven value">';
@ -404,7 +404,7 @@ print '<tr class="liste_titre">';
print '<td colspan="2">'.$langs->trans('BindingOptions').'</td>';
print "</tr>\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 '<tr class="oddeven value">';

View File

@ -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');
}

View File

@ -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);
}

View File

@ -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';

View File

@ -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) {

View File

@ -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;

View File

@ -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
*/

View File

@ -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 '<tr class="oddeven" id="rowid-'.$obj->rowid.'">';
$tmpaction = 'edit';
@ -1075,21 +1075,25 @@ if ($num) {
print '<td class="center">';
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="rowid" value="'.$rowid.'">';
print '<input type="submit" class="button buttongen button-save" name="actionmodify" value="'.$langs->trans("Modify").'">';
if ($action == 'edit') {
print '<input type="submit" class="button buttongen button-save" name="actionmodify" value="'.$langs->trans("Modify").'">';
}
print '<div name="'.(!empty($obj->rowid) ? $obj->rowid : $obj->code).'"></div>';
print '<input type="submit" class="button buttongen button-cancel" name="actioncancel" value="'.$langs->trans("Cancel").'">';
print '</td>';
}
// 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 '<td class="center">';
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="rowid" value="'.$rowid.'">';
print '<input type="submit" class="button buttongen button-save" name="actionmodify" value="'.$langs->trans("Modify").'">';
if ($action == 'edit') {
print '<input type="submit" class="button buttongen button-save" name="actionmodify" value="'.$langs->trans("Modify").'">';
}
print '<div name="'.(!empty($obj->rowid) ? $obj->rowid : $obj->code).'"></div>';
print '<input type="submit" class="button buttongen button-cancel" name="actioncancel" value="'.$langs->trans("Cancel").'">';
print '</td>';
@ -1113,18 +1117,18 @@ if ($num) {
if ($showfield) {
// Show line for topic, joinfiles and content
if ($tmpfieldlist == 'topic') {
print '<strong>'.$form->textwithpicto($langs->trans("Topic"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'</strong> ';
print '<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.'-'.$rowid.'" value="'.(!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '').'">';
print '<div class="minwidth150 inline-block bold">'.$form->textwithpicto($langs->trans("Topic"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'</div> ';
print '<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.'-'.$rowid.'" value="'.(!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '').'"'.($action != 'edit' ? ' disabled' : '').'>';
print '<br>'."\n";
}
if ($tmpfieldlist == 'email_from') {
print '<strong>'.$form->textwithpicto($langs->trans("MailFrom"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'</strong> ';
print '<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.'-'.$rowid.'" value="'.(!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '').'">';
print '<div class="minwidth150 inline-block bold">'.$form->textwithpicto($langs->trans("MailFrom"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'</div> ';
print '<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.'-'.$rowid.'" value="'.(!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '').'"'.($action != 'edit' ? ' disabled' : '').'>';
print '<br>'."\n";
}
if ($tmpfieldlist == 'joinfiles') {
print '<strong>'.$form->textwithpicto($langs->trans("FilesAttachedToEmail"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'</strong> ';
print $form->selectyesno($tmpfieldlist.'-'.$rowid, (isset($obj->$tmpfieldlist) ? $obj->$tmpfieldlist : '0'), 1, false, 0, 1);
print '<div class="minwidth150 inline-block bold">'.$form->textwithpicto($langs->trans("FilesAttachedToEmail"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'</div> ';
print $form->selectyesno($tmpfieldlist.'-'.$rowid, (isset($obj->$tmpfieldlist) ? $obj->$tmpfieldlist : '0'), 1, ($action != 'edit'), 0, 1);
print '<br>'."\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 '<td class="center nowraponall" width="64">';
if ($canbemodified) {
print '<a class="reposition editfielda" href="'.$url.'&action=edit&token='.newToken().'">'.img_edit().'</a>';
} else {
print '<a class="reposition editfielda" href="'.$url.'&action=preview&token='.newToken().'">'.img_view().'</a>';
}
if ($iserasable) {
print '<a class="reposition marginleftonly" href="'.$url.'&action=delete&token='.newToken().'">'.img_delete().'</a>';
@ -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 '<td></td>';
} elseif ($value == 'fk_user') {
print '<td>';
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 '</td>';
} elseif ($value == 'lang') {
print '<td>';
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 '<td class="center">';
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 '<input type="hidden" name="type_template" value="'.$obj->type_template.'">';
print $obj->type_template;
@ -1422,6 +1428,8 @@ function fieldList($fieldlist, $obj = null, $tabname = '', $context = '')
//print '<td></td>';
} elseif ($context == 'edit' && in_array($value, array('topic', 'joinfiles', 'content', 'content_lines'))) {
print '<td></td>';
} elseif ($context == 'preview' && in_array($value, array('topic', 'joinfiles', 'content', 'content_lines'))) {
print '<td></td>';
} elseif ($context == 'hide' && in_array($value, array('topic', 'joinfiles', 'content', 'content_lines'))) {
//print '<td></td>';
} else {
@ -1451,14 +1459,14 @@ function fieldList($fieldlist, $obj = null, $tabname = '', $context = '')
}
print '<td'.($classtd ? ' class="'.$classtd.'"' : '').'>';
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 '<input type="text" '.$size.'class="flat'.($class ? ' '.$class : '').'" value="'.(isset($obj->$value) ? $obj->$value : '').'" name="'. $value .'">';
print '<input type="text" '.$size.'class="flat'.($class ? ' '.$class : '').'" value="'.(isset($obj->$value) ? $obj->$value : '').'" name="'. $value .'"'.($context == 'preview' ? ' disabled' : '').'>';
}
print '</td>';
}

View File

@ -262,7 +262,7 @@ if ($result) {
if ($user->admin) {
print '<td class="right">';
$htmltext = $langs->trans("ID").': '.$obj->id;
$htmltext .= '<br>'.$langs->trans("Permission").': user->rights->'.$obj->module.'->'.$obj->perms.($obj->subperms ? '->'.$obj->subperms : '');
$htmltext .= '<br>'.$langs->trans("Permission").': user->hasRight(\''.$obj->module.'\', \''.$obj->perms.'\''.($obj->subperms ? ', \''.$obj->subperms.'\'' : '').')';
print $form->textwithpicto('', $htmltext);
//print '<span class="opacitymedium">'.$obj->id.'</span>';
print '</td>';

View File

@ -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();
}

View File

@ -195,7 +195,7 @@ if (!$base) {
print "</tr>\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) {

View File

@ -85,19 +85,20 @@ if (!$base) {
}
}
// var_dump($link);
print '<table class="noborder">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Fields").'</td><td>'.$langs->trans("Type").'</td><td>'.$langs->trans("Index").'</td>';
print '<td></td>';
print '<td></td>';
print '<td></td>';
print '<td></td>';
print '<td>'.$langs->trans("Fields").'</td>';
print '<td>'.$langs->trans("Type").'</td>';
print '<td>'.$langs->trans("Collation").'</td>';
print '<td>'.$langs->trans("Null").'</td>';
print '<td>'.$langs->trans("Index").'</td>';
print '<td>'.$langs->trans("Default").'</td>';
print '<td>'.$langs->trans("Extra").'</td>';
print '<td>'.$langs->trans("Privileges").'</td>';
print '<td>'.$langs->trans("FieldsLinked").'</td>';
print '</tr>';
//$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 '<tr class="oddeven">';
// field
print "<td>".$row[0]."</td>";
// type
print "<td>".$row[1]."</td>";
// collation
print "<td>".$row[2]."</td>";
// null
print "<td>".$row[3]."</td>";
// key
print "<td>".(empty($row[4]) ? '' : $row[4])."</td>";
// default
print "<td>".(empty($row[5]) ? '' : $row[5])."</td>";
// extra
print "<td>".(empty($row[6]) ? '' : $row[6])."</td>";
// privileges
print "<td>".(empty($row[7]) ? '' : $row[7])."</td>";
print "<td>".(isset($link[$row[0]][0]) ? $link[$row[0]][0] : '').".";

View File

@ -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]);

View File

@ -62,7 +62,7 @@ class DolibarrApiAccess implements iAuthenticate
/**
* @var User $user Loggued user
*/
public static $user = '';
public static $user = null;
/**

View File

@ -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);
// }

View File

@ -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) {

View File

@ -159,8 +159,7 @@ if ($object->id > 0) {
{
$langs->load("projects");
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
if ($user->rights->bom->creer)
{
if ($user->hasRight('bom', 'creer')) {
if ($action != 'classify')
//$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&token='.newToken().'&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
$morehtmlref.=' : ';

View File

@ -513,8 +513,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$morehtmlref = '<div class="refidno">';
/*
// 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.='<br>'.$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 '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=disable&token='.newToken().'">'.$langs->trans("Disable").'</a>'."\n";
if ($user->hasRight('bom', 'write')) {
if ($object->status == 1) {
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=disable&token='.newToken().'">'.$langs->trans("Disable").'</a>'."\n";
} else {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=enable&token='.newToken().'">'.$langs->trans("Enable").'</a>'."\n";
}
}
else
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=enable&token='.newToken().'">'.$langs->trans("Enable").'</a>'."\n";
}
}
*/
*/
// Delete
print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $permissiontodelete);

View File

@ -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();

View File

@ -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)

View File

@ -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 '<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.'"><span class="amount">'.price(price2num($sub_bom_line->total_cost, 'MT')).'</span></td>';

View File

@ -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).'/';

View File

@ -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');

View File

@ -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;

View File

@ -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;

View File

@ -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 '</div>';
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).'/';

View File

@ -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;

View File

@ -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');
}

View File

@ -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');
}

View File

@ -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;

View File

@ -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);
}

View File

@ -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) {

View File

@ -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;

View File

@ -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);
}

View File

@ -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 '<div class="liste_titre liste_titre_bydiv centpercent">';
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 '</div>';
print '<div class="div-table-responsive-no-min sectioncalendarbymonth maxscreenheightless300">';

View File

@ -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 '<div class="liste_titre liste_titre_bydiv centpercent">';
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 '</div>';
print '<div class="div-table-responsive">';

View File

@ -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 '<div class="liste_titre liste_titre_bydiv centpercent">';
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 '</div>';
@ -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;

View File

@ -459,7 +459,7 @@ if ($object->fetch($id) >= 0) {
print "</div>";
// 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';
}
}

View File

@ -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 <email>'
$object->email_replyto = (string) GETPOST("replyto", 'alphawithlgt'); // Must allow 'name <email>'
$object->email_errorsto = (string) GETPOST("errorsto", 'alphawithlgt'); // Must allow 'name <email>'
@ -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 .= '</span></i>';
$availablelink = $form->textwithpicto('<span class="opacitymedium">'.$langs->trans("AvailableVariables").'</span>', $htmltext, 1, 'help', '', 0, 2, 'availvar');
$availablelink = $form->textwithpicto('<span class="opacitymedium">'.$langs->trans("AvailableVariables").'</span>', $htmltext, 1, 'helpclickable', '', 0, 2, 'availvar');
//print '<a href="javascript:document_preview(\''.DOL_URL_ROOT.'/admin/modulehelp.php?id='.$objMod->numero.'\',\'text/html\',\''.dol_escape_js($langs->trans("Module")).'\')">'.img_picto($langs->trans("ClickToShowDescription"), $imginfo).'</a>';
@ -789,9 +792,40 @@ if ($action == 'create') {
print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("MailTitle").'</td><td><input class="flat minwidth300" name="title" value="'.dol_escape_htmltag(GETPOST('title')).'" autofocus="autofocus"></td></tr>';
print '<tr><td class="fieldrequired">'.$langs->trans("MailFrom").'</td><td><input class="flat minwidth200" name="from" value="'.getDolGlobalString('MAILING_EMAIL_FROM').'"></td></tr>';
if (getDolGlobalInt('EMAILINGS_SUPPORT_ALSO_SMS')) {
$arrayoftypes = array("email" => "Email", "sms" => "SMS");
print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("Type").'</td><td>';
print $form->selectarray('messtype', $arrayoftypes, (GETPOSTISSET('messtype') ? GETPOST('messtype') : 'email'), 0, 0);
print '<tr><td>'.$langs->trans("MailErrorsTo").'</td><td><input class="flat minwidth200" name="errorsto" value="'.getDolGlobalString('MAILING_EMAIL_ERRORSTO', getDolGlobalString('MAIN_MAIL_ERRORS_TO')).'"></td></tr>';
print '<script>
$( document ).ready(function() {
jQuery("#messtype").on("change", function() {
console.log("We change the message ttpe");
if (jQuery("#messtype").val() == "email") {
jQuery(".fieldsforsms").hide();
jQuery(".fieldsforemail").show();
}
if (jQuery("#messtype").val() == "sms") {
jQuery(".fieldsforsms").show();
jQuery(".fieldsforemail").hide();
}
});
jQuery("#messtype").change();
})
</script>';
print '</td></tr>';
}
print '</table>';
print '<br><br>';
print '<table class="border centpercent">';
print '<tr class="fieldsforemail"><td class="fieldrequired titlefieldcreate">'.$langs->trans("MailFrom").'</td><td><input class="flat minwidth200" name="from" value="'.(GETPOSTISSET('from') ? GETPOST('from') : getDolGlobalString('MAILING_EMAIL_FROM')).'"></td></tr>';
print '<tr class="fieldsforsms hidden"><td class="fieldrequired titlefieldcreate">'.$langs->trans("PhoneFrom").'</td><td><input class="flat minwidth200" name="from" value="'.(GETPOSTISSET('from') ? GETPOST('from') : getDolGlobalString('MAILING_SMS_FROM')).'" placeholder="+123..."></td></tr>';
print '<tr class="fieldsforemail"><td>'.$langs->trans("MailErrorsTo").'</td><td><input class="flat minwidth200" name="errorsto" value="'.getDolGlobalString('MAILING_EMAIL_ERRORSTO', getDolGlobalString('MAIN_MAIL_ERRORS_TO')).'"></td></tr>';
// Other attributes
$parameters = array();
@ -805,8 +839,8 @@ if ($action == 'create') {
print '<br><br>';
print '<table class="border centpercent">';
print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("MailTopic").'</td><td><input class="flat minwidth200 quatrevingtpercent" name="sujet" value="'.dol_escape_htmltag(GETPOST('sujet', 'alphanohtml')).'"></td></tr>';
print '<tr><td>'.$langs->trans("BackgroundColorByDefault").'</td><td colspan="3">';
print '<tr class="fieldsforemail"><td class="fieldrequired titlefieldcreate">'.$langs->trans("MailTopic").'</td><td><input class="flat minwidth200 quatrevingtpercent" name="sujet" value="'.dol_escape_htmltag(GETPOST('sujet', 'alphanohtml')).'"></td></tr>';
print '<tr class="fieldsforemail"><td>'.$langs->trans("BackgroundColorByDefault").'</td><td colspan="3">';
print $htmlother->selectColor(GETPOST('bgcolor'), 'bgcolor', '', 0);
print '</td></tr>';
@ -821,7 +855,7 @@ if ($action == 'create') {
print dol_get_fiche_end();
print $form->buttonsSaveCancel("CreateMailing", 'Cancel');
print $form->buttonsSaveCancel("Create", 'Cancel');
print '</form>';
} 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 '<tr><td class="titlefield">';
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 '</td><td>';
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 '</td></tr>';
// Errors to
print '<tr><td>';
print $form->editfieldkey("MailErrorsTo", 'email_errorsto', $object->email_errorsto, $object, $user->hasRight('mailing', 'creer') && $object->statut < 3, 'string');
print '</td><td>';
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 '<tr><td>';
print $form->editfieldkey("MailErrorsTo", 'email_errorsto', $object->email_errorsto, $object, $user->hasRight('mailing', 'creer') && $object->status < $object::STATUS_SENTCOMPLETELY, 'string');
print '</td><td>';
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 '</td></tr>';
}
print '</td></tr>';
print '</table>';
print '</div>';
@ -991,7 +1027,7 @@ if ($action == 'create') {
print '<table class="border centpercent tableforfield">';
// Number of distinct emails
print '<tr><td class="titlefield">';
print '<tr><td>';
print $langs->trans("TotalNbOfDistinctRecipients");
print '</td><td>';
$nbemail = ($object->nbemail ? $object->nbemail : 0);
@ -1018,21 +1054,24 @@ if ($action == 'create') {
print '<tr><td>';
print $langs->trans("MAIN_MAIL_SENDMODE");
print '</td><td>';
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 ' <span class="opacitymedium">(';
print getDolGlobalString('MAIN_MAIL_SMTP_SERVER_EMAILING', getDolGlobalString('MAIN_MAIL_SMTP_SERVER'));
print ')</span>';
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 ' <span class="opacitymedium">('.getDolGlobalString('MAIN_MAIL_SMTP_SERVER_EMAILING').')</span>';
}
} elseif (getDolGlobalString('MAIN_MAIL_SENDMODE') != 'mail' && getDolGlobalString('MAIN_MAIL_SMTP_SERVER')) {
print ' <span class="opacitymedium">('.getDolGlobalString('MAIN_MAIL_SMTP_SERVER').')</span>';
}
} else {
print 'SMS ';
print ' <span class="opacitymedium">('.getDolGlobalString('MAIN_MAIL_SMTP_SERVER').')</span>';
}
print '</td></tr>';
@ -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<div class=\"tabsAction\">\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 '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=settodraft&token='.newToken().'&id='.$object->id.'">'.$langs->trans("SetToDraft").'</a>';
}
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 '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit&token='.newToken().'&id='.$object->id.'">'.$langs->trans("EditWithEditor").'</a>';
} else {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit&token='.newToken().'&id='.$object->id.'">'.$langs->trans("EditWithTextEditor").'</a>';
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edittxt&token='.newToken().'&id='.$object->id.'">'.$langs->trans("EditWithTextEditor").'</a>';
}
if (!empty($conf->use_javascript_ajax)) {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edithtml&token='.newToken().'&id='.$object->id.'">'.$langs->trans("EditHTMLSource").'</a>';
if (!getDolGlobalInt('EMAILINGS_SUPPORT_ALSO_SMS')) {
if (!empty($conf->use_javascript_ajax)) {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edithtml&token='.newToken().'&id='.$object->id.'">'.$langs->trans("EditHTMLSource").'</a>';
}
}
}
@ -1089,17 +1130,17 @@ if ($action == 'create') {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=test&token='.newToken().'&id='.$object->id.'">'.$langs->trans("TestMailing").'</a>';
}
if ($object->statut == 0) {
if ($object->status == 0) {
if ($object->nbemail <= 0) {
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("NoTargetYet")).'">'.$langs->trans("ValidMailing").'</a>';
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("NoTargetYet")).'">'.$langs->trans("Validate").'</a>';
} elseif (!$user->hasRight('mailing', 'valider')) {
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("NotEnoughPermissions")).'">'.$langs->trans("ValidMailing").'</a>';
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("NotEnoughPermissions")).'">'.$langs->trans("Validate").'</a>';
} else {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=valid&amp;id='.$object->id.'">'.$langs->trans("ValidMailing").'</a>';
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=valid&amp;id='.$object->id.'">'.$langs->trans("Validate").'</a>';
}
}
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 '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("SendingFromWebInterfaceIsNotAllowed")).'">'.$langs->trans("SendMailing").'</a>';
} elseif (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !$user->hasRight('mailing', 'mailing_advance', 'send')) {
@ -1113,7 +1154,7 @@ if ($action == 'create') {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=clone&amp;object=emailing&amp;id='.$object->id.'">'.$langs->trans("ToClone").'</a>';
}
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 '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("NotEnoughPermissions")).'">'.$langs->trans("ResetMailing").'</a>';
} 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 '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("NotEnoughPermissions")).'">'.$langs->trans("DeleteMailing").'</a>';
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 '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("NotEnoughPermissions")).'">'.$langs->trans("Delete").'</a>';
} else {
print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?action=delete&token='.newToken().'&id='.$object->id.(!empty($urlfrom) ? '&urlfrom='.$urlfrom : '').'">'.$langs->trans("DeleteMailing").'</a>';
print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?action=delete&token='.newToken().'&id='.$object->id.(!empty($urlfrom) ? '&urlfrom='.$urlfrom : '').'">'.$langs->trans("Delete").'</a>';
}
}
@ -1188,21 +1229,25 @@ if ($action == 'create') {
print '<table class="bordernooddeven tableforfield centpercent">';
// Subject
print '<tr><td class="titlefield">'.$langs->trans("MailTopic").'</td><td colspan="3">'.$object->sujet.'</td></tr>';
if ($object->messtype != 'sms') {
print '<tr><td class="titlefield">'.$langs->trans("MailTopic").'</td><td colspan="3">'.$object->sujet.'</td></tr>';
}
// Joined files
print '<tr><td>'.$langs->trans("MailFile").'</td><td colspan="3">';
// 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 '<br>';
if ($object->messtype != 'sms') {
print '<tr><td>'.$langs->trans("MailFile").'</td><td colspan="3">';
// 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 '<br>';
}
} else {
print '<span class="opacitymedium">'.$langs->trans("NoAttachedFiles").'</span><br>';
}
} else {
print '<span class="opacitymedium">'.$langs->trans("NoAttachedFiles").'</span><br>';
print '</td></tr>';
}
print '</td></tr>';
// Background color
/*print '<tr><td width="15%">'.$langs->trans("BackgroundColorByDefault").'</td><td colspan="3">';
@ -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 '<tr><td class="titlefield">'.$langs->trans("MailFrom").'</td><td>'.dol_print_email($object->email_from, 0, 0, 0, 0, 1).'</td></tr>';
print '<tr><td class="titlefield">';
print $langs->trans("MailFrom");
print '</td><td>'.dol_print_email($object->email_from, 0, 0, 0, 0, 1).'</td></tr>';
// To
print '<tr><td>'.$langs->trans("MailErrorsTo").'</td><td>'.dol_print_email($object->email_errorsto, 0, 0, 0, 0, 1).'</td></tr>';
if ($object->messtype != 'sms') {
print '<tr><td>'.$langs->trans("MailErrorsTo").'</td><td>'.dol_print_email($object->email_errorsto, 0, 0, 0, 0, 1).'</td></tr>';
}
print '</table>';
print '</div>';
@ -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 '<table class="bordernooddeven centpercent">';
// Subject
print '<tr><td class="fieldrequired titlefield">'.$langs->trans("MailTopic").'</td><td colspan="3"><input class="flat quatrevingtpercent" type="text" name="sujet" value="'.$object->sujet.'"></td></tr>';
if ($object->messtype != 'sms') {
print '<tr><td class="fieldrequired titlefield">';
print $langs->trans("MailTopic");
print '</td><td colspan="3"><input class="flat quatrevingtpercent" type="text" name="sujet" value="'.$object->sujet.'"></td></tr>';
}
$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 '<tr><td>'.$langs->trans("MailFile").'</td>';
print '<td colspan="3">';
// List of files
$listofpaths = dol_dir_list($upload_dir, 'all', 0, '', '', 'name', SORT_ASC, 0);
if ($object->messtype != 'sms') {
$addfileaction = 'addfile';
print '<tr><td>'.$langs->trans("MailFile").'</td>';
print '<td colspan="3">';
// 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 .= '<input type="hidden" class="removedfilehidden" name="removedfile" value="">'."\n";
$out .= '<script type="text/javascript">';
$out .= 'jQuery(document).ready(function () {';
$out .= ' jQuery(".removedfile").click(function() {';
$out .= ' jQuery(".removedfilehidden").val(jQuery(this).val());';
$out .= ' });';
$out .= '})';
$out .= '</script>'."\n";
if (count($listofpaths)) {
foreach ($listofpaths as $key => $val) {
$out .= '<div id="attachfile_'.$key.'">';
$out .= img_mime($listofpaths[$key]['name']).' '.$listofpaths[$key]['name'];
$out .= ' <input type="image" style="border: 0px;" src="'.img_picto($langs->trans("Search"), 'delete.png', '', '', 1).'" value="'.($key + 1).'" class="removedfile" id="removedfile_'.$key.'" name="removedfile_'.$key.'" />';
$out .= '<br></div>';
// TODO Trick to have param removedfile containing nb of image to delete. But this does not works without javascript
$out .= '<input type="hidden" class="removedfilehidden" name="removedfile" value="">'."\n";
$out .= '<script type="text/javascript">';
$out .= 'jQuery(document).ready(function () {';
$out .= ' jQuery(".removedfile").click(function() {';
$out .= ' jQuery(".removedfilehidden").val(jQuery(this).val());';
$out .= ' });';
$out .= '})';
$out .= '</script>'."\n";
if (count($listofpaths)) {
foreach ($listofpaths as $key => $val) {
$out .= '<div id="attachfile_'.$key.'">';
$out .= img_mime($listofpaths[$key]['name']).' '.$listofpaths[$key]['name'];
$out .= ' <input type="image" style="border: 0px;" src="'.img_picto($langs->trans("Search"), 'delete.png', '', '', 1).'" value="'.($key + 1).'" class="removedfile" id="removedfile_'.$key.'" name="removedfile_'.$key.'" />';
$out .= '<br></div>';
}
} else {
//$out .= '<span class="opacitymedium">'.$langs->trans("NoAttachedFiles").'</span><br>';
}
} else {
//$out .= '<span class="opacitymedium">'.$langs->trans("NoAttachedFiles").'</span><br>';
}
// Add link to add file
$maxfilesizearray = getMaxFileSizeArray();
$maxmin = $maxfilesizearray['maxmin'];
if ($maxmin > 0) {
$out .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file
}
$out .= '<input type="file" class="flat" id="addedfile" name="addedfile" value="'.$langs->trans("Upload").'" />';
$out .= ' ';
$out .= '<input type="submit" class="button smallpaddingimp" id="'.$addfileaction.'" name="'.$addfileaction.'" value="'.$langs->trans("MailingAddFile").'" />';
print $out;
print '</td></tr>';
// Add link to add file
$maxfilesizearray = getMaxFileSizeArray();
$maxmin = $maxfilesizearray['maxmin'];
if ($maxmin > 0) {
$out .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file
}
$out .= '<input type="file" class="flat" id="addedfile" name="addedfile" value="'.$langs->trans("Upload").'" />';
$out .= ' ';
$out .= '<input type="submit" class="button smallpaddingimp" id="'.$addfileaction.'" name="'.$addfileaction.'" value="'.$langs->trans("MailingAddFile").'" />';
print $out;
print '</td></tr>';
// Background color
print '<tr><td>'.$langs->trans("BackgroundColorByDefault").'</td><td colspan="3">';
print $htmlother->selectColor($object->bgcolor, 'bgcolor', '', 0);
print '</td></tr>';
// Background color
print '<tr><td>'.$langs->trans("BackgroundColorByDefault").'</td><td colspan="3">';
print $htmlother->selectColor($object->bgcolor, 'bgcolor', '', 0);
print '</td></tr>';
}
print '</table>';
@ -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';

View File

@ -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 '</td></tr>';
// Errors to
print '<tr><td>'.$langs->trans("MailErrorsTo").'</td><td>';
$emailarray = CMailFile::getArrayAddress($object->email_errorsto);
foreach ($emailarray as $email => $name) {
if ($name != $email) {
print dol_escape_htmltag($name).' &lt;'.$email;
print '&gt;';
if (!isValidEmail($email)) {
$langs->load("errors");
print img_warning($langs->trans("ErrorBadEMail", $email));
if ($object->messtype != 'sms') {
print '<tr><td>'.$langs->trans("MailErrorsTo").'</td><td>';
$emailarray = CMailFile::getArrayAddress($object->email_errorsto);
foreach ($emailarray as $email => $name) {
if ($name != $email) {
print dol_escape_htmltag($name).' &lt;'.$email;
print '&gt;';
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 '</td></tr>';
}
print '</td></tr>';
print '</table>';
print '</div>';
@ -340,13 +347,13 @@ if ($object->fetch($id) >= 0) {
print '<table class="border centpercent tableforfield">';
// Number of distinct emails
print '<tr><td class="titlefield">';
print '<tr><td>';
print $langs->trans("TotalNbOfDistinctRecipients");
print '</td><td>';
$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 '<br>';
$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 '<div class="tagtr liste_titre">';
print '<div class="tagtd"></div>';
print '<div class="tagtd">'.$langs->trans("RecipientSelectionModules").'</div>';
print '<div class="tagtd center maxwidth150">'.$langs->trans("NbOfUniqueEMails").'</div>';
print '<div class="tagtd left"><div class="inline-block">'.$langs->trans("Filters").'</div>';
print ' &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <div class=" inline-block">'.$langs->trans("EvenUnsubscribe").' ';
print ajax_object_onoff($object, 'evenunsubscribe', 'evenunsubscribe', 'EvenUnsubscribe:switch_on:warning', 'EvenUnsubscribe', array(), 'small valignmiddle', '', 1);
print '<div class="tagtd center maxwidth150">';
if ($object->messtype != 'sms') {
print $langs->trans("NbOfUniqueEMails");
} else {
print $langs->trans("NbOfUniquePhones");
}
print '</div>';
print '<div class="tagtd left"><div class="inline-block">'.$langs->trans("Filters").'</div>';
if ($object->messtype != 'sms') {
print ' &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <div class=" inline-block">'.$langs->trans("EvenUnsubscribe").' ';
print ajax_object_onoff($object, 'evenunsubscribe', 'evenunsubscribe', 'EvenUnsubscribe:switch_on:warning', 'EvenUnsubscribe', array(), 'small valignmiddle', '', 1);
print '</div>';
}
print '</div>';
print '<div class="tagtd">&nbsp;</div>';
print '</div>'; // End tr
@ -648,14 +670,14 @@ if ($object->fetch($id) >= 0) {
print '<input type="hidden" name="page_y" value="">';
$morehtmlcenter = '';
if ($allowaddtarget) {
if ($object->status == $object::STATUS_DRAFT) {
$morehtmlcenter = '<span class="opacitymedium hideonsmartphone">'.$langs->trans("ToClearAllRecipientsClickHere").'</span> <a href="'.$_SERVER["PHP_SELF"].'?clearlist=1&id='.$object->id.'" class="button reposition smallpaddingimp">'.$langs->trans("TargetsReset").'</a>';
}
$morehtmlcenter .= ' &nbsp; <a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=exportcsv&token='.newToken().'&exportcsv=1&id='.$object->id.'">'.img_picto('', 'download', 'class="pictofixedwidth"').$langs->trans("Download").'</a>';
$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 '</form>';
@ -776,12 +798,12 @@ if ($object->fetch($id) >= 0) {
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="center">';
print '<!-- ID mailing_cibles = '.$obj->rowid.' -->';
if ($obj->statut == $object::STATUS_DRAFT) { // Not sent yet
if ($obj->status == $object::STATUS_DRAFT) { // Not sent yet
if ($user->hasRight('mailing', 'creer')) {
print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=delete&token='.newToken().'&rowid='.((int) $obj->rowid).$param.'">'.img_delete($langs->trans("RemoveRecipient")).'</a>';
}
}
/*if ($obj->statut == -1) // Sent with error
/*if ($obj->status == -1) // Sent with error
{
print '<a href="'.$_SERVER['PHP_SELF'].'?action=retry&rowid='.$obj->rowid.$param.'">'.$langs->trans("Retry").'</a>';
}*/
@ -834,7 +856,7 @@ if ($object->fetch($id) >= 0) {
// Date sent
print '<td class="center nowraponall">';
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 '<td class="nowrap center">';
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 '</td>';
@ -853,12 +875,12 @@ if ($object->fetch($id) >= 0) {
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="center">';
print '<!-- ID mailing_cibles = '.$obj->rowid.' -->';
if ($obj->statut == $object::STATUS_DRAFT) { // Not sent yet
if ($obj->status == $object::STATUS_DRAFT) { // Not sent yet
if ($user->hasRight('mailing', 'creer')) {
print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=delete&token='.newToken().'&rowid='.((int) $obj->rowid).$param.'">'.img_delete($langs->trans("RemoveRecipient")).'</a>';
}
}
/*if ($obj->statut == -1) // Sent with error
/*if ($obj->status == -1) // Sent with error
{
print '<a href="'.$_SERVER['PHP_SELF'].'?action=retry&rowid='.$obj->rowid.$param.'">'.$langs->trans("Retry").'</a>';
}*/
@ -869,7 +891,7 @@ if ($object->fetch($id) >= 0) {
$i++;
}
} else {
if ($object->statut < $object::STATUS_SENTPARTIALY) {
if ($object->status < $object::STATUS_SENTPARTIALY) {
print '<tr><td colspan="9">';
print '<span class="opacitymedium">'.$langs->trans("NoTargetYet").'</span>';
print '</td></tr>';

View File

@ -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";

View File

@ -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).' <u class="paddingrightonly">'.$langs->trans("ShowEMailing").'</u>';
if (isset($this->statut)) {
if (isset($this->status)) {
$datas['picto'] .= ' '.$this->getLibStatut(5);
}
$datas['ref'] = '<br><b>'.$langs->trans('Ref').':</b> '.$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

View File

@ -152,7 +152,7 @@ print '</div><div class="fichetwothirdright">';
* 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 '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td colspan="2">'.$langs->trans("LastMailings", $limit).'</td>';
if (getDolGlobalInt('EMAILINGS_SUPPORT_ALSO_SMS')) {
print '<td class="center">'.$langs->trans("Type").'</td>';
}
print '<td class="center">'.$langs->trans("DateCreation").'</td>';
print '<td class="center">'.$langs->trans("NbOfEMails").'</td>';
print '<td class="right"><a href="'.DOL_URL_ROOT.'/comm/mailing/list.php">'.$langs->trans("AllEMailings").'</a></td></tr>';
print '<td class="center">';
print $langs->trans("NbOfEMails");
if (getDolGlobalInt('EMAILINGS_SUPPORT_ALSO_SMS')) {
print ' | '.$langs->trans("Phone");
}
print '</td>';
print '<td class="right"><a href="'.DOL_URL_ROOT.'/comm/mailing/list.php">'.$langs->trans("AllEMailings").'</a></td>';
print '</tr>';
$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 '<tr class="oddeven">';
print '<td class="nowrap">'.$mailstatic->getNomUrl(1).'</td>';
print '<td>'.(!empty($obj->title) ? dol_trunc($obj->title, 38) : '').'</td>';
print '<td class="tdoverflowmax100">'.dol_escape_htmltag($obj->title).'</td>';
if (getDolGlobalInt('EMAILINGS_SUPPORT_ALSO_SMS')) {
print '<td class="center">'.dol_escape_htmltag($obj->messtype).'</td>';
}
print '<td class="center">'.dol_print_date($db->jdate($obj->date_creat), 'day').'</td>';
print '<td class="center">'.($obj->nbemail ? $obj->nbemail : "0").'</td>';
print '<td class="center">'.($obj->nbemail ? (int) $obj->nbemail : "0").'</td>';
print '<td class="right">'.$mailstatic->LibStatut($obj->status, 5).'</td>';
print '</tr>';
$i++;

View File

@ -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');

View File

@ -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 '<td class="liste_titre">';
print '<input type="text" class="flat maxwidth50" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
print '</td>';
// Message type
if (getDolGlobalInt('EMAILINGS_SUPPORT_ALSO_SMS')) {
print '<td class="liste_titre">';
print '<input type="text" class="flat maxwidth50" name="search_messtype" value="'.dol_escape_htmltag($search_messtype).'">';
print '</td>';
}
// Title
print '<td class="liste_titre">';
print '<input type="text" class="flat maxwidth100 maxwidth50onsmartphone" name="search_all" value="'.dol_escape_htmltag($search_all).'">';
@ -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 '<td>';
print $object->getNomUrl(1);
print '</td>';
// Message type
if (getDolGlobalInt('EMAILINGS_SUPPORT_ALSO_SMS')) {
print '<td>';
print dol_escape_htmltag($obj->messtype);
print '</td>';
}
// Title
print '<td class="tdoverflowmax200" title="'.dol_escape_htmltag($obj->title).'">'.dol_escape_htmltag($obj->title).'</td>';
@ -500,7 +541,7 @@ while ($i < $imaxinloop) {
if (!$filteremail) {
print '<td class="center nowraponall">';
$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 '<td align="center" class="nowrap">'.dol_print_date($db->jdate($obj->date_envoi), 'day').'</td>';
print '<td class="nowrap center">'.dol_print_date($db->jdate($obj->date_envoi), 'day').'</td>';
print '</td>';
// 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 '</td>';

View File

@ -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');

View File

@ -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);

View File

@ -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 {

View File

@ -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

View File

@ -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);

View File

@ -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

View File

@ -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) {

View File

@ -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) {

View File

@ -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 {

View File

@ -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);

View File

@ -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')),
);

View File

@ -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)."/";

View File

@ -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();
}

View File

@ -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);
}

View File

@ -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)) {

View File

@ -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 {

View File

@ -375,7 +375,7 @@ if ($result) {
$i++;
// Bank account
print '<tr><td class="titlefieldcreate">'.$langs->trans("Account").'</td>';
print '<tr><td class="titlefieldcreate">'.$langs->trans("BankAccount").'</td>';
print '<td>';
// $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 '</td></tr>';
}
//$user->rights->banque->modifier=false;
//$user->rights->banque->consolidate=true;
// Type of payment / Number
print "<tr><td>".$langs->trans("Type")." / ".$langs->trans("Numero");
print ' <em>('.$langs->trans("ChequeOrTransferNumber").')</em>';
@ -654,7 +651,7 @@ if ($result) {
print "</table>";
// 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 '
<script type="text/javascript">

View File

@ -126,8 +126,8 @@ 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');
$permissiontoadd = $user->rights->banque->modifier;
$permissiontodelete = $user->rights->banque->configurer;
$permissiontoadd = $user->hasRight('banque', 'modifier');
$permissiontodelete = $user->hasRight('banque', 'configurer');
$allowed = 0;
if ($user->hasRight('accounting', 'chartofaccount')) {

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2017-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
/* Copyright (C) 2017-2024 Alexandre Spangaro <aspangaro@easya.solutions>
* Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2023 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2023 Joachim Kueter <git-jk@bloxera.com>
@ -42,19 +42,19 @@ if (isModEnabled('project')) {
$langs->loadLangs(array("compta", "banks", "bills", "users", "accountancy", "categories"));
// Get parameters
$id = GETPOST('id', 'int');
$id = GETPOSTINT('id');
$action = GETPOST('action', 'alpha');
$confirm = GETPOST('confirm');
$cancel = GETPOST('cancel', 'aZ09');
$backtopage = GETPOST('backtopage', 'alpha');
$accountid = GETPOST("accountid") > 0 ? GETPOST("accountid", "int") : 0;
$accountid = GETPOSTINT("accountid") > 0 ? GETPOSTINT("accountid") : 0;
$label = GETPOST("label", "alpha");
$sens = GETPOST("sens", "int");
$amount = price2num(GETPOST("amount", "alpha"));
$sens = GETPOSTINT("sens");
$amount = GETPOSTFLOAT("amount");
$paymenttype = GETPOST("paymenttype", "aZ09");
$accountancy_code = GETPOST("accountancy_code", "alpha");
$projectid = (GETPOST('projectid', 'int') ? GETPOST('projectid', 'int') : GETPOST('fk_project', 'int'));
$projectid = GETPOSTINT('projectid') ? GETPOSTINT('projectid') : GETPOSTINT('fk_project');
if (isModEnabled('accounting') && getDolGlobalString('ACCOUNTANCY_COMBO_FOR_AUX')) {
$subledger_account = GETPOST("subledger_account", "alpha") > 0 ? GETPOST("subledger_account", "alpha") : '';
} else {
@ -62,7 +62,7 @@ if (isModEnabled('accounting') && getDolGlobalString('ACCOUNTANCY_COMBO_FOR_AUX'
}
// Security check
$socid = GETPOST("socid", "int");
$socid = GETPOSTINT("socid");
if ($user->socid) {
$socid = $user->socid;
}
@ -102,20 +102,20 @@ if (empty($reshook)) {
// Link to a project
if ($action == 'classin' && $permissiontoadd) {
$object->fetch($id);
$object->setProject(GETPOST('projectid', 'int'));
$object->setProject(GETPOSTINT('projectid'));
}
if ($action == 'add') {
$error = 0;
$datep = dol_mktime(12, 0, 0, GETPOST("datepmonth", 'int'), GETPOST("datepday", 'int'), GETPOST("datepyear", 'int'));
$datev = dol_mktime(12, 0, 0, GETPOST("datevmonth", 'int'), GETPOST("datevday", 'int'), GETPOST("datevyear", 'int'));
$datep = dol_mktime(12, 0, 0, GETPOSTINT("datepmonth"), GETPOSTINT("datepday"), GETPOSTINT("datepyear"));
$datev = dol_mktime(12, 0, 0, GETPOSTINT("datevmonth"), GETPOSTINT("datevday"), GETPOSTINT("datevyear"));
if (empty($datev)) {
$datev = $datep;
}
$object->ref = ''; // TODO
$object->accountid = GETPOST("accountid", 'int') > 0 ? GETPOST("accountid", "int") : 0;
$object->accountid = GETPOSTINT("accountid") > 0 ? GETPOSTINT("accountid") : 0;
$object->datev = $datev;
$object->datep = $datep;
$object->amount = price2num(GETPOST("amount", 'alpha'));
@ -272,8 +272,8 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && $permissiontoadd) {
$object->label = $langs->trans("CopyOf").' '.$object->label;
}
$newdatepayment = dol_mktime(0, 0, 0, GETPOST('clone_date_paymentmonth', 'int'), GETPOST('clone_date_paymentday', 'int'), GETPOST('clone_date_paymentyear', 'int'));
$newdatevalue = dol_mktime(0, 0, 0, GETPOST('clone_date_valuemonth', 'int'), GETPOST('clone_date_valueday', 'int'), GETPOST('clone_date_valueyear', 'int'));
$newdatepayment = dol_mktime(0, 0, 0, GETPOSTINT('clone_date_paymentmonth'), GETPOSTINT('clone_date_paymentday'), GETPOSTINT('clone_date_paymentyear'));
$newdatevalue = dol_mktime(0, 0, 0, GETPOSTINT('clone_date_valuemonth'), GETPOSTINT('clone_date_valueday'), GETPOSTINT('clone_date_valueyear'));
if ($newdatepayment) {
$object->datep = $newdatepayment;
}
@ -284,7 +284,7 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && $permissiontoadd) {
}
if (GETPOSTISSET("clone_sens")) {
$object->sens = GETPOST("clone_sens", 'int');
$object->sens = GETPOSTINT("clone_sens");
} else {
$object->sens = $object->sens;
}
@ -649,10 +649,11 @@ if ($id) {
$editvalue = '';
if (isModEnabled('accounting')) {
print '<tr><td class="nowrap">';
print $form->editfieldkey('AccountAccounting', 'accountancy_code', $object->accountancy_code, $object, (!$alreadyaccounted && $user->hasRight('banque', 'modifier')), 'string', '', 0);
print $form->editfieldkey('AccountAccounting', 'accountancy_code', $object->accountancy_code, $object, (!$alreadyaccounted && $permissiontoadd), 'string', '', 0);
print '</td><td>';
if ($action == 'editaccountancy_code') {
print $form->editfieldval('AccountAccounting', 'accountancy_code', $object->accountancy_code, $object, (!$alreadyaccounted && $user->hasRight('banque', 'modifier')), 'string', '', 0);
if ($action == 'editaccountancy_code' && (!$alreadyaccounted && $permissiontoadd)) {
//print $form->editfieldval('AccountAccounting', 'accountancy_code', $object->accountancy_code, $object, (!$alreadyaccounted && $user->hasRight('banque', 'modifier')), 'string', '', 0);
print $formaccounting->formAccountingAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->accountancy_code, 'accountancy_code', 0, 1, '', 1);
} else {
$accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch('', $object->accountancy_code, 1);
@ -672,7 +673,15 @@ if ($id) {
print '<tr><td class="nowrap">';
print $form->editfieldkey('SubledgerAccount', 'subledger_account', $object->subledger_account, $object, (!$alreadyaccounted && $permissiontoadd), 'string', '', 0);
print '</td><td>';
print $form->editfieldval('SubledgerAccount', 'subledger_account', $object->subledger_account, $object, (!$alreadyaccounted && $permissiontoadd), 'string', '', 0, null, '', 1, 'lengthAccounta');
if ($action == 'editsubledger_account' && (!$alreadyaccounted && $permissiontoadd)) {
if (getDolGlobalString('ACCOUNTANCY_COMBO_FOR_AUX')) {
print $formaccounting->formAccountingAccount($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->subledger_account, 'subledger_account', 1, 1, '', 1);
} else {
print $form->editfieldval('SubledgerAccount', 'subledger_account', $object->subledger_account, $object, (!$alreadyaccounted && $permissiontoadd), 'string', '', 0, null, '', 1, 'lengthAccounta');
}
} else {
print length_accounta($object->subledger_account);
}
print '</td></tr>';
$bankaccountnotfound = 0;

View File

@ -70,7 +70,7 @@ $object->fetch($id, $ref);
$upload_dir = $conf->bank->dir_output.'/'.dol_sanitizeFileName($object->id);
$modulepart = 'banque';
$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
@ -153,7 +153,7 @@ if ($object->id) {
print dol_get_fiche_end();
$modulepart = 'banque';
$permissiontoadd = $user->rights->banque->modifier;
$permissiontoadd = $user->hasRight('banque', 'modifier');
$param = '&id='.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
} else {

View File

@ -122,9 +122,9 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
$object->fields = dol_sort_array($object->fields, 'position');
$arrayfields = dol_sort_array($arrayfields, 'position');
$permissiontoread = (!empty($user->rights->cashdesk->run) || !empty($user->rights->takepos->run));
$permissiontoadd = (!empty($user->rights->cashdesk->run) || !empty($user->rights->takepos->run));
$permissiontodelete = (!empty($user->rights->cashdesk->run) || !empty($user->rights->takepos->run));
$permissiontoread = ($user->hasRight('cashdesk', 'run') || $user->hasRight('takepos', 'run'));
$permissiontoadd = ($user->hasRight('cashdesk', 'run') || $user->hasRight('takepos', 'run'));
$permissiontodelete = ($user->hasRight('cashdesk', 'run') || $user->hasRight('takepos', 'run'));
// Security check
if ($user->socid > 0) { // Protection if external user

View File

@ -262,16 +262,6 @@ class CashControl extends CommonObject
return 0;
}
/*
$posmodule = $this->posmodule;
if (!empty($user->rights->$posmodule->use))
{
$this->error='NotEnoughPermissions';
dol_syslog(get_class($this)."::valid ".$this->error, LOG_ERR);
return -1;
}
*/
$now = dol_now();
// Update request

View File

@ -148,7 +148,7 @@ if (isModEnabled('tax') && $user->hasRight('tax', 'charges', 'lire')) {
print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "pc.datep", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("Type", $_SERVER["PHP_SELF"], "pct.code", "", $param, '', $sortfield, $sortorder);
if (isModEnabled("banque")) {
print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("BankAccount", $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $sortfield, $sortorder);
}
print_liste_field_titre("PayedByThisPayment", $_SERVER["PHP_SELF"], "pc.amount", "", $param, 'class="right"', $sortfield, $sortorder);
print "</tr>\n";
@ -318,7 +318,7 @@ if (isModEnabled('tax') && $user->hasRight('tax', 'charges', 'lire')) {
print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "ptva.datep", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("Type", $_SERVER["PHP_SELF"], "pct.code", "", $param, '', $sortfield, $sortorder);
if (isModEnabled("banque")) {
print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("BankAccount", $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $sortfield, $sortorder);
}
print_liste_field_titre("PayedByThisPayment", $_SERVER["PHP_SELF"], "ptva.amount", "", $param, 'class="right"', $sortfield, $sortorder);
print "</tr>\n";

View File

@ -53,7 +53,7 @@ $object = new Deplacement($db);
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('tripsandexpensescard', 'globalcard'));
$permissionnote = $user->rights->deplacement->creer; // Used by the include of actions_setnotes.inc.php
$permissionnote = $user->hasRight('deplacement', 'creer'); // Used by the include of actions_setnotes.inc.php
/*
@ -492,7 +492,7 @@ if ($action == 'create') {
}
}
$permissiontodelete = $user->rights->deplacement->supprimer;
$permissiontodelete = $user->hasRight('deplacement', 'supprimer');
print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $permissiontodelete);
print '</div>';

View File

@ -75,7 +75,7 @@ if ($user->socid) {
}
$result = restrictedArea($user, 'deplacement', $id, '');
$permissiontoadd = $user->rights->deplacement->creer; // Used by the include of actions_dellink.inc.php
$permissiontoadd = $user->hasRight('deplacement', 'creer'); // Used by the include of actions_dellink.inc.php
/*
@ -129,7 +129,7 @@ if ($object->id) {
print '</div>';
$modulepart = 'deplacement';
$permissiontoadd = $user->rights->deplacement->creer;
$permissiontoadd = $user->hasRight('deplacement', 'creer');
$param = '&id='.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
} else {

View File

@ -115,12 +115,12 @@ $usercanread = $user->hasRight('facture', 'lire');
$usercancreate = $user->hasRight('facture', 'creer');
$usercanissuepayment = $user->hasRight('facture', 'paiement');
$usercandelete = $user->hasRight('facture', 'supprimer');
$usercanvalidate = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $usercancreate) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !empty($user->rights->facture->invoice_advance->validate)));
$usercanvalidate = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $usercancreate) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('facture', 'invoice_advance', 'validate')));
$usercansend = (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') || $user->rights->facture->invoice_advance->send);
$usercanreopen = (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') || $user->rights->facture->invoice_advance->reopen);
$usercanunvalidate = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !empty($usercancreate)) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !empty($user->rights->facture->invoice_advance->unvalidate)));
$usercanunvalidate = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !empty($usercancreate)) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('facture', 'invoice_advance', 'unvalidate')));
$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'));
$usercancreatemargin = $user->hasRight("margins", "creer");
$usercanreadallmargin = $user->hasRight("margins", "liretous");
$usercancreatewithdrarequest = $user->hasRight("prelevement", "bons", "creer");
@ -168,8 +168,6 @@ if (empty($reshook)) {
// Mass actions
/*$objectclass='MyObject';
$objectlabel='MyObject';
$permissiontoread = $user->rights->mymodule->read;
$permissiontodelete = $user->rights->mymodule->delete;
$uploaddir = $conf->mymodule->dir_output;
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';*/

View File

@ -144,18 +144,18 @@ $usercandelete = $user->hasRight("facture", "supprimer");
$usercancreatecontract = $user->hasRight("contrat", "creer");
// Advanced Permissions
$usercanvalidate = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $usercancreate) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !empty($user->rights->facture->invoice_advance->validate)));
$usercansend = (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !empty($user->rights->facture->invoice_advance->send)));
$usercanreopen = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $usercancreate) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !empty($user->rights->facture->invoice_advance->reopen)));
$usercanvalidate = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $usercancreate) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('facture', 'invoice_advance', 'validate')));
$usercansend = (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('facture', 'invoice_advance', 'send')));
$usercanreopen = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $usercancreate) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('facture', 'invoice_advance', 'reopen')));
if (getDolGlobalString('INVOICE_DISALLOW_REOPEN')) {
$usercanreopen = false;
}
$usercanunvalidate = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !empty($usercancreate)) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !empty($user->rights->facture->invoice_advance->unvalidate)));
$usercanunvalidate = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !empty($usercancreate)) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('facture', 'invoice_advance', 'unvalidate')));
$usermustrespectpricemin = ((getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && empty($user->rights->produit->ignore_price_min_advance)) || !getDolGlobalString('MAIN_USE_ADVANCED_PERMS'));
$usercancreatemargin = (!empty($user->rights->margins->creer) ? $user->rights->margins->creer : 0);
$usercanreadallmargin = (!empty($user->rights->margins->liretous) ? $user->rights->margins->liretous : 0);
$usercancreatewithdrarequest = (!empty($user->rights->prelevement->bons->creer) ? $user->rights->prelevement->bons->creer : 0);
$usermustrespectpricemin = ((getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !$user->hasRight('produit', 'ignore_price_min_advance')) || !getDolGlobalString('MAIN_USE_ADVANCED_PERMS'));
$usercancreatemargin = $user->hasRight('margins', 'creer');
$usercanreadallmargin = $user->hasRight('margins', 'liretous');
$usercancreatewithdrarequest = $user->hasRight('prelevement', 'bons', 'creer');
$permissionnote = $usercancreate; // Used by the include of actions_setnotes.inc.php
$permissiondellink = $usercancreate; // Used by the include of actions_dellink.inc.php

View File

@ -192,7 +192,7 @@ class Invoices 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;
}
@ -282,7 +282,7 @@ class Invoices extends DolibarrApi
*/
public function post($request_data = null)
{
if (!DolibarrApiAccess::$user->rights->facture->creer) {
if (!DolibarrApiAccess::$user->hasRight('facture', 'creer')) {
throw new RestException(401, "Insuffisant rights");
}
// Check mandatory fields
@ -335,7 +335,7 @@ class Invoices extends DolibarrApi
if (!DolibarrApiAccess::$user->hasRight('commande', 'lire')) {
throw new RestException(403);
}
if (!DolibarrApiAccess::$user->rights->facture->creer) {
if (!DolibarrApiAccess::$user->hasRight('facture', 'creer')) {
throw new RestException(403);
}
if (empty($orderid)) {
@ -376,7 +376,7 @@ class Invoices extends DolibarrApi
if (!DolibarrApiAccess::$user->hasRight('contrat', 'lire')) {
throw new RestException(403);
}
if (!DolibarrApiAccess::$user->rights->facture->creer) {
if (!DolibarrApiAccess::$user->hasRight('facture', 'creer')) {
throw new RestException(403);
}
if (empty($contractid)) {
@ -443,7 +443,7 @@ class Invoices extends DolibarrApi
*/
public function putLine($id, $lineid, $request_data = null)
{
if (!DolibarrApiAccess::$user->rights->facture->creer) {
if (!DolibarrApiAccess::$user->hasRight('facture', 'creer')) {
throw new RestException(403);
}
@ -514,7 +514,7 @@ class Invoices extends DolibarrApi
*/
public function postContact($id, $contactid, $type)
{
if (!DolibarrApiAccess::$user->rights->facture->creer) {
if (!DolibarrApiAccess::$user->hasRight('facture', 'creer')) {
throw new RestException(403);
}
@ -562,7 +562,7 @@ class Invoices extends DolibarrApi
*/
public function deleteContact($id, $contactid, $type)
{
if (!DolibarrApiAccess::$user->rights->facture->creer) {
if (!DolibarrApiAccess::$user->hasRight('facture', 'creer')) {
throw new RestException(403);
}
@ -607,7 +607,7 @@ class Invoices extends DolibarrApi
*/
public function deleteLine($id, $lineid)
{
if (!DolibarrApiAccess::$user->rights->facture->creer) {
if (!DolibarrApiAccess::$user->hasRight('facture', 'creer')) {
throw new RestException(403);
}
if (empty($lineid)) {
@ -640,7 +640,7 @@ class Invoices extends DolibarrApi
*/
public function put($id, $request_data = null)
{
if (!DolibarrApiAccess::$user->rights->facture->creer) {
if (!DolibarrApiAccess::$user->hasRight('facture', 'creer')) {
throw new RestException(403);
}
@ -745,7 +745,7 @@ class Invoices extends DolibarrApi
*/
public function postLine($id, $request_data = null)
{
if (!DolibarrApiAccess::$user->rights->facture->creer) {
if (!DolibarrApiAccess::$user->hasRight('facture', 'creer')) {
throw new RestException(403);
}
@ -833,7 +833,7 @@ class Invoices extends DolibarrApi
*/
public function addContact($id, $fk_socpeople, $type_contact, $source, $notrigger = 0)
{
if (!DolibarrApiAccess::$user->rights->facture->creer) {
if (!DolibarrApiAccess::$user->hasRight('facture', 'creer')) {
throw new RestException(403);
}
$result = $this->invoice->fetch($id);
@ -881,7 +881,7 @@ class Invoices extends DolibarrApi
*/
public function settodraft($id, $idwarehouse = -1)
{
if (!DolibarrApiAccess::$user->rights->facture->creer) {
if (!DolibarrApiAccess::$user->hasRight('facture', 'creer')) {
throw new RestException(403);
}
$result = $this->invoice->fetch($id);
@ -932,7 +932,7 @@ class Invoices extends DolibarrApi
*/
public function validate($id, $idwarehouse = 0, $notrigger = 0)
{
if (!DolibarrApiAccess::$user->rights->facture->creer) {
if (!DolibarrApiAccess::$user->hasRight('facture', 'creer')) {
throw new RestException(403);
}
$result = $this->invoice->fetch($id);
@ -981,7 +981,7 @@ class Invoices extends DolibarrApi
*/
public function settopaid($id, $close_code = '', $close_note = '')
{
if (!DolibarrApiAccess::$user->rights->facture->creer) {
if (!DolibarrApiAccess::$user->hasRight('facture', 'creer')) {
throw new RestException(403);
}
$result = $this->invoice->fetch($id);
@ -1030,7 +1030,7 @@ class Invoices extends DolibarrApi
*/
public function settounpaid($id)
{
if (!DolibarrApiAccess::$user->rights->facture->creer) {
if (!DolibarrApiAccess::$user->hasRight('facture', 'creer')) {
throw new RestException(403);
}
$result = $this->invoice->fetch($id);
@ -1118,7 +1118,7 @@ class Invoices extends DolibarrApi
{
require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
if (!DolibarrApiAccess::$user->rights->facture->creer) {
if (!DolibarrApiAccess::$user->hasRight('facture', 'creer')) {
throw new RestException(403);
}
@ -1287,7 +1287,7 @@ class Invoices extends DolibarrApi
*/
public function useDiscount($id, $discountid)
{
if (!DolibarrApiAccess::$user->rights->facture->creer) {
if (!DolibarrApiAccess::$user->hasRight('facture', 'creer')) {
throw new RestException(403);
}
if (empty($id)) {
@ -1334,7 +1334,7 @@ class Invoices extends DolibarrApi
{
require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
if (!DolibarrApiAccess::$user->rights->facture->creer) {
if (!DolibarrApiAccess::$user->hasRight('facture', 'creer')) {
throw new RestException(403);
}
if (empty($id)) {
@ -1426,7 +1426,7 @@ class Invoices extends DolibarrApi
{
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
if (!DolibarrApiAccess::$user->rights->facture->creer) {
if (!DolibarrApiAccess::$user->hasRight('facture', 'creer')) {
throw new RestException(403);
}
if (empty($id)) {
@ -1546,7 +1546,7 @@ class Invoices extends DolibarrApi
{
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
if (!DolibarrApiAccess::$user->rights->facture->creer) {
if (!DolibarrApiAccess::$user->hasRight('facture', 'creer')) {
throw new RestException(403);
}
foreach ($arrayofamounts as $id => $amount) {
@ -1680,7 +1680,7 @@ class Invoices extends DolibarrApi
{
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
if (!DolibarrApiAccess::$user->rights->facture->creer) {
if (!DolibarrApiAccess::$user->hasRight('facture', 'creer')) {
throw new RestException(403);
}
if (empty($id)) {

View File

@ -82,7 +82,8 @@ if ($contextpage == 'poslist') {
$optioncss = 'print';
}
$userid = GETPOST('userid', 'int');
$lineid = GETPOSTINT('lineid');
$userid = GETPOSTINT('userid');
$search_ref = GETPOST('sf_ref') ? GETPOST('sf_ref', 'alpha') : GETPOST('search_ref', 'alpha');
$search_refcustomer = GETPOST('search_refcustomer', 'alpha');
$search_type = GETPOST('search_type', 'int');
@ -116,28 +117,28 @@ $search_customer_code = GETPOST("search_customer_code", 'alphanohtml');
$search_type_thirdparty = GETPOST("search_type_thirdparty", 'int');
$search_user = GETPOST('search_user', 'int');
$search_sale = GETPOST('search_sale', 'int');
$search_date_startday = GETPOST('search_date_startday', 'int');
$search_date_startmonth = GETPOST('search_date_startmonth', 'int');
$search_date_startyear = GETPOST('search_date_startyear', 'int');
$search_date_endday = GETPOST('search_date_endday', 'int');
$search_date_endmonth = GETPOST('search_date_endmonth', 'int');
$search_date_endyear = GETPOST('search_date_endyear', 'int');
$search_date_startday = GETPOSTINT('search_date_startday');
$search_date_startmonth = GETPOSTINT('search_date_startmonth');
$search_date_startyear = GETPOSTINT('search_date_startyear');
$search_date_endday = GETPOSTINT('search_date_endday');
$search_date_endmonth = GETPOSTINT('search_date_endmonth');
$search_date_endyear = GETPOSTINT('search_date_endyear');
$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver
$search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
$search_date_valid_startday = GETPOST('search_date_valid_startday', 'int');
$search_date_valid_startmonth = GETPOST('search_date_valid_startmonth', 'int');
$search_date_valid_startyear = GETPOST('search_date_valid_startyear', 'int');
$search_date_valid_endday = GETPOST('search_date_valid_endday', 'int');
$search_date_valid_endmonth = GETPOST('search_date_valid_endmonth', 'int');
$search_date_valid_endyear = GETPOST('search_date_valid_endyear', 'int');
$search_date_valid_startday = GETPOSTINT('search_date_valid_startday');
$search_date_valid_startmonth = GETPOSTINT('search_date_valid_startmonth');
$search_date_valid_startyear = GETPOSTINT('search_date_valid_startyear');
$search_date_valid_endday = GETPOSTINT('search_date_valid_endday');
$search_date_valid_endmonth = GETPOSTINT('search_date_valid_endmonth');
$search_date_valid_endyear = GETPOSTINT('search_date_valid_endyear');
$search_date_valid_start = dol_mktime(0, 0, 0, $search_date_valid_startmonth, $search_date_valid_startday, $search_date_valid_startyear); // Use tzserver
$search_date_valid_end = dol_mktime(23, 59, 59, $search_date_valid_endmonth, $search_date_valid_endday, $search_date_valid_endyear);
$search_datelimit_startday = GETPOST('search_datelimit_startday', 'int');
$search_datelimit_startmonth = GETPOST('search_datelimit_startmonth', 'int');
$search_datelimit_startyear = GETPOST('search_datelimit_startyear', 'int');
$search_datelimit_endday = GETPOST('search_datelimit_endday', 'int');
$search_datelimit_endmonth = GETPOST('search_datelimit_endmonth', 'int');
$search_datelimit_endyear = GETPOST('search_datelimit_endyear', 'int');
$search_datelimit_startday = GETPOSTINT('search_datelimit_startday');
$search_datelimit_startmonth = GETPOSTINT('search_datelimit_startmonth');
$search_datelimit_startyear = GETPOSTINT('search_datelimit_startyear');
$search_datelimit_endday = GETPOSTINT('search_datelimit_endday');
$search_datelimit_endmonth = GETPOSTINT('search_datelimit_endmonth');
$search_datelimit_endyear = GETPOSTINT('search_datelimit_endyear');
$search_datelimit_start = dol_mktime(0, 0, 0, $search_datelimit_startmonth, $search_datelimit_startday, $search_datelimit_startyear);
$search_datelimit_end = dol_mktime(23, 59, 59, $search_datelimit_endmonth, $search_datelimit_endday, $search_datelimit_endyear);
$search_categ_cus = GETPOST("search_categ_cus", 'int');
@ -152,7 +153,7 @@ if ($search_late == 'late') {
}
$filtre = GETPOST('filtre', 'alpha');
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
@ -242,10 +243,10 @@ $arrayfields = array(
'f.multicurrency_total_ttc'=>array('label'=>'MulticurrencyAmountTTC', 'checked'=>0, 'enabled'=>(!isModEnabled('multicurrency') ? 0 : 1), 'position'=>292),
'multicurrency_dynamount_payed'=>array('label'=>'MulticurrencyAlreadyPaid', 'checked'=>0, 'enabled'=>(!isModEnabled('multicurrency') ? 0 : 1), 'position'=>295),
'multicurrency_rtp'=>array('label'=>'MulticurrencyRemainderToPay', 'checked'=>0, 'enabled'=>(!isModEnabled('multicurrency') ? 0 : 1), 'position'=>296), // Not enabled by default because slow
'total_pa' => array('label' => ((getDolGlobalString('MARGIN_TYPE') == '1') ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (!isModEnabled('margin') || empty($user->rights->margins->liretous) ? 0 : 1)),
'total_margin' => array('label' => 'Margin', 'checked' => 0, 'position' => 301, 'enabled' => (!isModEnabled('margin') || empty($user->rights->margins->liretous) ? 0 : 1)),
'total_margin_rate' => array('label' => 'MarginRate', 'checked' => 0, 'position' => 302, 'enabled' => (!isModEnabled('margin') || empty($user->rights->margins->liretous) || !getDolGlobalString('DISPLAY_MARGIN_RATES') ? 0 : 1)),
'total_mark_rate' => array('label' => 'MarkRate', 'checked' => 0, 'position' => 303, 'enabled' => (!isModEnabled('margin') || empty($user->rights->margins->liretous) || !getDolGlobalString('DISPLAY_MARK_RATES') ? 0 : 1)),
'total_pa' => array('label' => ((getDolGlobalString('MARGIN_TYPE') == '1') ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (!isModEnabled('margin') || !$user->hasRight('margins', 'liretous') ? 0 : 1)),
'total_margin' => array('label' => 'Margin', 'checked' => 0, 'position' => 301, 'enabled' => (!isModEnabled('margin') || !$user->hasRight('margins', 'liretous') ? 0 : 1)),
'total_margin_rate' => array('label' => 'MarginRate', 'checked' => 0, 'position' => 302, 'enabled' => (!isModEnabled('margin') || !$user->hasRight('margins', 'liretous') || !getDolGlobalString('DISPLAY_MARGIN_RATES') ? 0 : 1)),
'total_mark_rate' => array('label' => 'MarkRate', 'checked' => 0, 'position' => 303, 'enabled' => (!isModEnabled('margin') || !$user->hasRight('margins', 'liretous') || !getDolGlobalString('DISPLAY_MARK_RATES') ? 0 : 1)),
'f.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500),
'f.tms' =>array('type'=>'timestamp', 'label'=>'DateModificationShort', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>502),
'u.login'=>array('label'=>"UserAuthor", 'checked'=>1, 'position'=>504),
@ -410,9 +411,9 @@ if ($action == 'makepayment_confirm' && $user->hasRight('facture', 'paiement'))
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
$arrayofselected = is_array($toselect) ? $toselect : array();
if (!empty($arrayofselected)) {
$bankid = GETPOST('bankid', 'int');
$paiementid = GETPOST('paiementid', 'int');
$paiementdate = dol_mktime(12, 0, 0, GETPOST('datepaimentmonth', 'int'), GETPOST('datepaimentday', 'int'), GETPOST('datepaimentyear', 'year'));
$bankid = GETPOSTINT('bankid');
$paiementid = GETPOSTINT('paiementid');
$paiementdate = dol_mktime(12, 0, 0, GETPOSTINT('datepaimentmonth'), GETPOSTINT('datepaimentday'), GETPOSTINT('datepaimentyear'));
if (empty($paiementdate)) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
$error++;

View File

@ -47,8 +47,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php';
// par de nombreux modules (banque, facture, commande a facturer, etc...) independamment
// de l'utilisation de la compta ou non. C'est au sein de cet espace que chaque sous fonction
// est protegee par le droit qui va bien du module concerne.
//if (!$user->rights->compta->general->lire)
// accessforbidden();
// Load translation files required by the page
$langs->loadLangs(array('compta', 'bills'));

View File

@ -247,7 +247,8 @@ foreach ($tabfac as $key => $val) {
print '<tr class="oddeven">';
print "<td>".dol_print_date($db->jdate($val["date"]))."</td>";
print "<td>".$invoicestatic->getNomUrl(1)."</td>";
print "<td>".$k."</td><td>".$line['label']."</td>";
print "<td>".$k."</td>";
print "<td>".$line['label']."</td>";
if (isset($line['inv'])) {
print '<td class="right">'.($mt < 0 ? price(-$mt) : '')."</td>";

View File

@ -186,7 +186,7 @@ if ($action == 'create') {
print "</tr>";
// Bank account
print '<tr><td class="fieldrequired" id="label_fk_account">'.$langs->trans("Account").'</td><td>';
print '<tr><td class="fieldrequired" id="label_fk_account">'.$langs->trans("BankAccount").'</td><td>';
print img_picto('', 'bank_account', 'pictofixedwidth');
$form->select_comptes(GETPOST("accountid", "int"), "accountid", 0, "courant=1", 2, '', 0, 'maxwidth500 widthcentpercentminusx'); // Affiche liste des comptes courant
print '</td></tr>';

View File

@ -486,7 +486,7 @@ class Localtax extends CommonObject
return -4;
}
if (isModEnabled("banque") && (empty($this->accountid) || $this->accountid <= 0)) {
$this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Account"));
$this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("BankAccount"));
return -5;
}
if (isModEnabled("banque") && (empty($this->paymenttype) || $this->paymenttype <= 0)) {

View File

@ -46,10 +46,10 @@ $langs->loadLangs(array('companies', 'bills', 'banks', 'multicurrency'));
$action = GETPOST('action', 'alpha');
$confirm = GETPOST('confirm', 'alpha');
$facid = GETPOST('facid', 'int');
$accountid = GETPOST('accountid', 'int');
$facid = GETPOSTINT('facid');
$accountid = GETPOSTINT('accountid');
$paymentnum = GETPOST('num_paiement', 'alpha');
$socid = GETPOST('socid', 'int');
$socid = GETPOSTINT('socid');
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
@ -100,7 +100,7 @@ if (empty($reshook)) {
if (($action == 'add_paiement' || ($action == 'confirm_paiement' && $confirm == 'yes')) && $usercanissuepayment) {
$error = 0;
$datepaye = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
$datepaye = dol_mktime(12, 0, 0, GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear'));
$paiement_id = 0;
$totalpayment = 0;
$multicurrency_totalpayment = 0;
@ -216,7 +216,7 @@ if (empty($reshook)) {
if ($action == 'confirm_paiement' && $confirm == 'yes' && $usercanissuepayment) {
$error = 0;
$datepaye = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'), 'tzuser');
$datepaye = dol_mktime(12, 0, 0, GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear'), 'tzuser');
$db->begin();
@ -269,7 +269,7 @@ if (empty($reshook)) {
$paiement->paiementid = dol_getIdFromCode($db, GETPOST('paiementcode'), 'c_paiement', 'code', 'id', 1);
$paiement->num_payment = GETPOST('num_paiement', 'alpha');
$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
@ -287,7 +287,7 @@ if (empty($reshook)) {
if (GETPOST('type') == Facture::TYPE_CREDIT_NOTE) {
$label = '(CustomerInvoicePaymentBack)'; // Refund of a credit note
}
$result = $paiement->addPaymentToBank($user, 'payment', $label, GETPOST('accountid', 'int'), GETPOST('chqemetteur'), GETPOST('chqbank'));
$result = $paiement->addPaymentToBank($user, 'payment', $label, GETPOSTINT('accountid'), GETPOST('chqemetteur'), GETPOST('chqbank'));
if ($result < 0) {
setEventMessages($paiement->error, $paiement->errors, 'errors');
$error++;
@ -488,7 +488,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
// Date payment
print '<tr><td><span class="fieldrequired">'.$langs->trans('Date').'</span></td><td>';
$datepayment = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
$datepayment = dol_mktime(12, 0, 0, GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear'));
$datepayment = ($datepayment == '' ? (!getDolGlobalString('MAIN_AUTOFILL_DATE') ? -1 : '') : $datepayment);
print $form->selectDate($datepayment, '', '', '', 0, "add_paiement", 1, 1, 0, '', '', $facture->date);
print '</td></tr>';

View File

@ -84,11 +84,11 @@ if ($user->socid) {
}
$result = restrictedArea($user, 'cheque', $id, 'bordereau_cheque', '', 'fk_user_author', $fieldname);
$usercanread = $user->rights->banque->cheque;
$usercancreate = $user->rights->banque->cheque;
$usercandelete = $user->rights->banque->cheque;
$usercanread = $user->hasRight('banque', 'cheque');
$usercancreate = $user->hasRight('banque', 'cheque');
$usercandelete = $user->hasRight('banque', 'cheque');
$permissiontodelete = $user->rights->banque->cheque;
$permissiontodelete = $user->hasRight('banque', 'cheque');
// List of payment mode to support
// Example: BANK_PAYMENT_MODES_FOR_DEPOSIT_MANAGEMENT = 'CHQ','TRA'

View File

@ -148,7 +148,7 @@ foreach ($arrayofpaymentmodetomanage as $val) {
}
print '</th>';
print '<th>'.$langs->trans("Date")."</th>";
print '<th>'.$langs->trans("Account").'</th>';
print '<th>'.$langs->trans("BankAccount").'</th>';
print '<th class="right">'.$langs->trans("NbOfCheques").'</th>';
print '<th class="right">'.$langs->trans("Amount").'</th>';
print '<th class="right">'.$langs->trans("Status").'</th>';

View File

@ -93,7 +93,7 @@ $arrayfields = array(
'bc.ref' => array('label'=>"Ref", 'checked'=>1, 'position'=>10),
'bc.type' => array('label'=>"Type", 'checked'=>1, 'position'=>20),
'bc.date_bordereau' => array('label'=>"DateCreation", 'checked'=>1, 'position'=>30),
'ba.label' => array('label'=>"Account", 'checked'=>1, 'position'=>40),
'ba.label' => array('label'=>"BankAccount", 'checked'=>1, 'position'=>40),
'bc.nbcheque' => array('label'=>"NbOfCheques", 'checked'=>1, 'position'=>50),
'bc.amount' => array('label'=>"Amount", 'checked'=>1, 'position'=>60),
'bc.statut' => array('label'=>"Status", 'checked'=>1, 'position'=>70)

View File

@ -365,7 +365,6 @@ class Cpaiement extends CommonDict
public function initAsSpecimen()
{
$this->id = 0;
$this->code = '';
$this->libelle = '';
$this->label = '';

View File

@ -104,7 +104,7 @@ $arrayfields = array(
's.nom' => array('label'=>"ThirdParty", 'checked'=>1, 'position'=>30),
'c.libelle' => array('label'=>"Type", 'checked'=>1, 'position'=>40),
'transaction' => array('label'=>"BankTransactionLine", 'checked'=>1, 'position'=>50, 'enabled'=>(isModEnabled("banque"))),
'ba.label' => array('label'=>"Account", 'checked'=>1, 'position'=>60, 'enabled'=>(isModEnabled("banque"))),
'ba.label' => array('label'=>"BankAccount", 'checked'=>1, 'position'=>60, 'enabled'=>(isModEnabled("banque"))),
'p.num_paiement' => array('label'=>"Numero", 'checked'=>1, 'position'=>70, 'tooltip'=>"ChequeOrTransferNumber"),
'p.amount' => array('label'=>"Amount", 'checked'=>1, 'position'=>80),
'p.statut' => array('label'=>"Status", 'checked'=>1, 'position'=>90, 'enabled'=>(getDolGlobalString('BILL_ADD_PAYMENT_VALIDATION'))),

View File

@ -45,7 +45,7 @@ if ($user->socid) {
}
$result = restrictedArea($user, 'paymentbybanktransfer', '', '');
$usercancreate = $user->rights->paymentbybanktransfer->create;
$usercancreate = $user->hasRight('paymentbybanktransfer', 'create');
/*

View File

@ -44,7 +44,7 @@ if ($user->socid) {
}
$result = restrictedArea($user, 'prelevement', '', 'bons');
$usercancreate = $user->rights->prelevement->bons->creer;
$usercancreate = $user->hasRight('prelevement', 'bons', 'creer');
/*

View File

@ -71,10 +71,10 @@ $search_amount = GETPOST('search_amount', 'alpha');
$bon = new BonPrelevement($db);
$hookmanager->initHooks(array('withdrawalsreceiptslist'));
$usercancreate = $user->rights->prelevement->bons->creer;
$usercancreate = $user->hasRight('prelevement', 'bons', 'creer');
$permissiontodelete = $user->hasRight('prelevement', 'creer');
if ($type == 'bank-transfer') {
$usercancreate = $user->rights->paymentbybanktransfer->create;
$usercancreate = $user->hasRight('paymentbybanktransfer', 'create');
$permissiontodelete = $user->hasRight('paymentbybanktransfer', 'create');
}

View File

@ -83,11 +83,11 @@ if ($id > 0 || $ref) {
$object->fetch($id, $ref);
}
$permissiontoread = $user->rights->tax->charges->lire;
$permissiontoadd = $user->rights->tax->charges->creer; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
$permissiontoread = $user->hasRight('tax', 'charges', 'lire');
$permissiontoadd = $user->hasRight('tax', 'charges', 'creer'); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
$permissiontodelete = $user->rights->tax->charges->supprimer || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_UNPAID);
$permissionnote = $user->rights->tax->charges->creer; // Used by the include of actions_setnotes.inc.php
$permissiondellink = $user->rights->tax->charges->creer; // Used by the include of actions_dellink.inc.php
$permissionnote = $user->hasRight('tax', 'charges', 'creer'); // Used by the include of actions_setnotes.inc.php
$permissiondellink = $user->hasRight('tax', 'charges', 'creer'); // Used by the include of actions_dellink.inc.php
$upload_dir = $conf->tax->multidir_output[isset($object->entity) ? $object->entity : 1];
// Security check
@ -843,9 +843,8 @@ if ($id > 0) {
$relativepath = $objref.'/'.$objref.'.pdf';
$filedir = $conf->tax->dir_output.'/'.$objref;
$urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
//$genallowed = $user->rights->tax->charges->lire; // If you can read, you can build the PDF to read content
$genallowed = 0;
$delallowed = $user->rights->tax->charges->creer; // If you can create/edit, you can remove a file on card
$delallowed = $user->hasRight('tax', 'charges', 'creer'); // If you can create/edit, you can remove a file on card
print $formfile->showdocuments('tax', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang);
}

View File

@ -79,7 +79,7 @@ if ($user->socid) {
}
$result = restrictedArea($user, 'tax', $object->id, 'chargesociales', 'charges');
$permissiontoadd = $user->rights->tax->charges->creer; // Used by the include of actions_dellink.inc.php
$permissiontoadd = $user->hasRight('tax', 'charges', 'creer'); // Used by the include of actions_dellink.inc.php
/*
@ -170,8 +170,8 @@ if ($object->id) {
print dol_get_fiche_end();
$modulepart = 'tax';
$permissiontoadd = $user->rights->tax->charges->creer;
$permtoedit = $user->rights->tax->charges->creer;
$permissiontoadd = $user->hasRight('tax', 'charges', 'creer');
$permtoedit = $user->hasRight('tax', 'charges', 'creer');
$param = '&id='.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
} else {

View File

@ -53,9 +53,9 @@ if ($user->socid) {
}
$result = restrictedArea($user, 'tax', $object->id, 'chargesociales', 'charges');
$permissiontoread = $user->rights->tax->charges->lire;
$permissiontoadd = $user->rights->tax->charges->creer;
$permissionnote = $user->rights->tax->charges->creer; // Used by the include of actions_setnotes.inc.php
$permissiontoread = $user->hasRight('tax', 'charges', 'lire');
$permissiontoadd = $user->hasRight('tax', 'charges', 'creer');
$permissionnote = $user->hasRight('tax', 'charges', 'creer'); // Used by the include of actions_setnotes.inc.php
/*

Some files were not shown because too many files have changed in this diff Show More