Merge branch 'develop' of https://github.com/Dolibarr/dolibarr into kanbanContactAdress

to resolve the conflict in project.lib.php
This commit is contained in:
Lamrani Abdel 2022-12-22 14:44:52 +01:00
commit 8bfb484467
385 changed files with 6181 additions and 4218 deletions

1
.gitignore vendored
View File

@ -19,6 +19,7 @@ default.properties
*.orig
Thumbs.db
/dolibarr_genesis.mp4
.phpunit.result.cache
# Log files
dolibarr_install.log
upgrade.log

View File

@ -95,19 +95,20 @@ notifications:
install:
- |
echo "Updating Composer"
rm $TRAVIS_BUILD_DIR/composer.json
rm $TRAVIS_BUILD_DIR/composer.lock
echo "Updating Composer config"
composer -V
composer self-update
composer -n init
composer -n config vendor-dir htdocs/includes
#rm $TRAVIS_BUILD_DIR/composer.json
#rm $TRAVIS_BUILD_DIR/composer.lock
#composer -n init
#composer -n config vendor-dir htdocs/includes
composer -n config -g vendor-dir htdocs/includes
echo
- |
echo "Installing Composer dependencies - PHP Unit, Parallel Lint, PHP CodeSniffer, PHP Vardump check - for $TRAVIS_PHP_VERSION"
echo "Update Composer version and Install tools - PHP Unit, Parallel Lint, PHP CodeSniffer, PHP Vardump check - for $TRAVIS_PHP_VERSION"
echo "(version 2.5 is bugged and generate phpunit error Exception: Serialization of 'Closure' is not allowed)"
if [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = '7.1' ] || [ "$TRAVIS_PHP_VERSION" = '7.2' ]; then
composer self-update 2.2.18
composer -n require phpunit/phpunit ^6 \
php-parallel-lint/php-parallel-lint ^1 \
php-parallel-lint/php-console-highlighter ^0 \
@ -115,6 +116,7 @@ install:
squizlabs/php_codesniffer ^3
fi
if [ "$TRAVIS_PHP_VERSION" = '7.3' ] || [ "$TRAVIS_PHP_VERSION" = '7.4' ]; then
composer self-update 2.2.18
composer -n require phpunit/phpunit ^7 \
php-parallel-lint/php-parallel-lint ^1.2 \
php-parallel-lint/php-console-highlighter ^0 \
@ -123,6 +125,7 @@ install:
fi
# phpunit 9 is required for php 8
if [ "$TRAVIS_PHP_VERSION" = '8.0' ] || [ "$TRAVIS_PHP_VERSION" = '8.1' ] || [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then
composer self-update 2.4.4
composer -n require --ignore-platform-reqs phpunit/phpunit ^8 \
php-parallel-lint/php-parallel-lint ^1.2 \
php-parallel-lint/php-console-highlighter ^0 \

View File

@ -3,6 +3,16 @@ English Dolibarr ChangeLog
--------------------------------------------------------------
***** ChangeLog for 18.0.0 compared to 17.0.0 *****
WARNING:
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
* The deprecated method escapeunderscore() of database handlers has been removed. You must use escapeforlike instead.
***** ChangeLog for 17.0.0 compared to 16.0.0 *****
For users:
@ -36,7 +46,6 @@ NEW: Accountancy - Add a way to clean some words when you generate thirdparty ac
NEW: Accountancy - Added an option during export to export or not the lettering FPC21
NEW: Accountancy - Manage supplier deposit with specific account
NEW: Accountancy - Model Digitaria - Add a way to clean some words when you generate thirdparty accounting account FPC22
NEW: Add a button "Test collect" in email collector
NEW: Add a constant to disallow modification of the product reference.
NEW: Add a method doAutoRenewContracts that can be used as a cron task.
NEW: Add " as enclosure by default for CSV export. Keep removing CR/LF.
@ -49,11 +58,7 @@ NEW: Add employment anniversary in birthday box
NEW: Add extrafield type "IP" to store IP addresses
NEW: Add fail2ban rules examples to limit access to /public pages
NEW: Add filter "Product subject to lot/Serial" in stock per lot/serial
NEW: Add free membership amounts at the membership type level
NEW: Add hidden option MAIN_EMAIL_SUPPORT_ACK to restore Email ack checkbox (feature abandonned by mailers)
NEW: Add IMAP port setting on email collector module
NEW: Adding JAPAN Chart-of-Account and regions/departments
NEW: Adding NIF verification for Algeria
NEW: Add link to create an element from the category page
NEW: add margin infos to takepos invoice lines
NEW: Add max size send for "backup and link to mail" option
@ -67,7 +72,6 @@ NEW: Add option --force on CLI cron_run_jobs.php
NEW: Add option "Show price on the generated documents for receptions"
NEW: Add performance index (name for company and contact) and llx_bank_url(url_id)
NEW: Add picto property on sub-module for password generation
NEW: Add price to product box in TakePOS
NEW: add redirect on action confirm addconsumedline and addproduceline
NEW: Add a new advanced permission "read price"
NEW: Add substitution key __SENDEREMAIL_SIGNATURE__
@ -89,30 +93,39 @@ NEW: Can set a commercial discount by entering amount including VAT
NEW: Can set a monthly frequency (or multiple) in cron tasks.
NEW: Can set start and end dates and comment on button "Activate all services"
NEW: can sort and preselected best supplier price
NEW: Website Can delete a whole website if disabled
NEW: Website Can remove a website template
NEW: Website can set header "Strict-Transport-Security" in web sites.
NEW: Website Can switch status of website and page from the website toolbar
NEW: Website Templates of websites are now directories and not zip into core repo
NEW: Website Add 4 other templates in website module
NEW: Can use products categories to make inventory
NEW: Change filter type on tickets list into a multiselect combo
NEW: conf TIMESPENT_ALWAYS_UPDATE_THM, when it's on we always check current thm of user to update it in task time line
NEW: constant PROPAL_NEW_AS_SIGNED
NEW: show date delivery planned on orders linked to company and product
NEW: default_lang for members
NEW: Default template of contract is not mandatory
NEW: Default values in extrafields are not more limited to 255 char.
NEW: display currency in takepos menu
NEW: Enable online signature for interventions
NEW: Encrypt all sensitive constants in llx_const
NEW: extrafield price with currency
NEW: filter on reception dates (from / to) in cheque paiement card
NEW: TakePOS Header Scroll in TakePOS
NEW: TakePOS Add setup parameters, can setup terminal name
NEW: TakePOS support of Stripe Terminal with Takepos
NEW: TakePOS Receipt preview in TakePOS setup
NEW: TakePOS different product list on smartphone
NEW: Contracts: Default template of contract is not mandatory
NEW: Contracts: Manage Position (Rank) on Contract Lines
NEW: EMail-Collector: add IMAP port setting
NEW: EMail-Collector: add a button "Test collect"
NEW: Members: default_lang for members
NEW: Members: Table of membership types
NEW: Members: add free membership amounts at the membership type level
NEW: Projects: add author on list
NEW: Proposals: show delivery mode on PDF for proposals
NEW: Reception: add a from/to on search on date field
NEW: TakePOS: Header Scroll in TakePOS
NEW: TakePOS: add price to product box in TakePOS
NEW: TakePOS: add setup parameters, can setup terminal name
NEW: TakePOS: support of Stripe Terminal with TakePOS
NEW: TakePOS: Receipt preview in TakePOS setup
NEW: TakePOS: different product list on smartphone
NEW: Website: can delete a whole website if disabled
NEW: Website: can remove a website template
NEW: Website: can set header "Strict-Transport-Security" in web sites.
NEW: Website: can switch status of website and page from the website toolbar
NEW: Website: Templates of websites are now directories and not zip into core repo
NEW: Website: add 4 other templates in website module
NEW: If we select another view list mode, we keep it
NEW: Init module bookcal
NEW: Introduce dolEncrypt and dolDecrypt to be able to encrypt data in db
@ -121,9 +134,8 @@ NEW: invoice export : add accounting affectation
NEW: label on products categories filter
NEW: The link "add to bookmark" is always on top in the bookmark popup
NEW: MAIN_SEARCH_CATEGORY_PRODUCT_ON_LISTS const to show category customer filter
NEW: Make module WebservicesClient deprecated. Use module WebHook instead
NEW: Make module WebservicesClient deprecated. Use module WebHook instead.
NEW: manage no email with thirdparties (better for GDPR)
NEW: Manage Position (Rank) on Contract Lines
NEW: Manage VAT on all lines on purchases cycle
NEW: manage virtual stock at a future date
NEW: On a bank reconciled line, we can modify the bank receipt
@ -138,9 +150,7 @@ NEW: possibility to select scopes with checkbox for Oauth tokens
NEW: private and public note on user, thirdparty and contact list
NEW: product categories filter on inventory list
NEW: Product supplier price: autofill default supplier VAT
NEW: Project - Add author on list
NEW: Public counters feature
NEW: Reception - Add a from/to on search on date field
NEW: Start a simple support of recurrent events on agenda
NEW: Resize parent company column in order list
NEW: Saved token of OAUTH module are now encrypted into llx_oauth_token
@ -159,24 +169,27 @@ NEW: SMTP using oauth2 authentication
NEW: can substitue project title in mail template
NEW: Supplier order list - Add column private and public note
NEW: Support IP type in extrafields
NEW: Table of membership types
NEW: The purge of files can purge only if older than a number of seconds
NEW: Update ActionComm type_code on email message ticket
NEW: VAT - Admin - Add information on deadline day for submission of VAT declaration
NEW: expand/collapse permissions on user permission page
NEW: Show delivery mode on PDF for proposals
NEW: Add the target to select attendees of event for emailings
Localisation:
NEW: adding JAPAN Chart-of-Account and regions/departments
NEW: adding NIF verification for Algeria
Modules
NEW: Experimental module Asset
For developers or integrators:
------------------------------
NEW: ModuleBuilder can generate code of class from an existing SQL table
NEW: #22370 Modulebuilder supports 'alwayseditable' (like extrafields)
NEW: #20912 Add trigger to record the event of sending an email from a project
NEW: #21750 Added "Get lines and Post lines from BOM" at the REST Service
NEW: #22370 Modulebuilder supports 'alwayseditable' (like extrafields)
NEW: Removed completely the need for the library adodbtime
NEW: hook on agenda pages
NEW: hook to complete payment in TakePOS

View File

@ -6,9 +6,8 @@ This file contains some policies about the security reports on Dolibarr ERP CRM
| Version | Supported |
| ---------- | ---------------------- |
| <= 15.0.0 | :x: |
| >= 15.0.1+ | :white_check_mark: except CSRF attacks|
| >= 16.0.0 | :white_check_mark: |
| <= 16.0.2 | :x: |
| >= 16.0.3 | :white_check_mark: |
| >= develop | :white_check_mark: |
## Reporting a Vulnerability

File diff suppressed because one or more lines are too long

View File

@ -1,14 +1,15 @@
<VirtualHost *:80>
#php_admin_value sendmail_path "/usr/sbin/sendmail -t -i"
#php_admin_value mail.force_extra_parameters "-f postmaster@mydomain.com"
php_admin_value sendmail_path "/usr/sbin/sendmail -t -i -f postmaster@mydomain.com"
#php_admin_value sendmail_path "/usr/sbin/sendmail -t -i -f postmaster@mydomain.com"
php_admin_value open_basedir /tmp/:/home/.../htdocs:/home/.../dolibarr_documents:
# Add this to use a custom apparmor profile when using apache php handler
<IfModule mod_apparmor.c>
AADefaultHatName sellyoursaas-instances
</IfModule>
<IfModule mod_apparmor.c>
AADefaultHatName sellyoursaas-instances
</IfModule>
ServerName myvirtualalias
@ -35,8 +36,8 @@
#AuthUserFile /etc/apache2/.htpasswd
#require valid-user
</Directory>
# Leaving /public and /api, /dav, .well_known but also wrappers for document and viewimage accessible to everyone
# Leaving /public and /api, /dav, .well_known but also wrappers for document, viewimage and public json/img accessible to everyone
<Directory /home/admin/wwwroot/dolibarr/htdocs/public/>
AuthType None
Require all granted

View File

@ -0,0 +1,19 @@
# Fail2Ban configuration file
#
# Regexp to detect forbidden access on pages (public or not) so we can add mitigation on IP making too much
# access to your a Dolibarr instance.
[Definition]
# To test, you can inject this example into log
# echo `myvirtualhost.com:443 1.2.3.4 - - [15/Dec/2022:09:57:47 +0000] "GET /public/abc" 403 123 "-" "Mozilla" >> /var/log/apache2/access.log
#
# then
# fail2ban-client status web-accesslog-limit403
#
# To test rule file on a existing log file
# fail2ban-regex /var/log/apache2/access.log /etc/fail2ban/filter.d/web-accesslog-limit403.conf
failregex = <HOST> - - .*HTTP/[0-9]+(.[0-9]+)?" 403
ignoreregex =

View File

@ -399,7 +399,7 @@ if ($resql) {
}
print "</select>";
print ajax_combobox("chartofaccounts");
print '<input type="'.(empty($conf->use_javascript_ajax) ? 'submit' : 'button').'" class="button button-edit" name="change_chart" id="change_chart" value="'.dol_escape_htmltag($langs->trans("ChangeAndLoad")).'">';
print '<input type="'.(empty($conf->use_javascript_ajax) ? 'submit' : 'button').'" class="button button-edit small" name="change_chart" id="change_chart" value="'.dol_escape_htmltag($langs->trans("ChangeAndLoad")).'">';
print '<br>';
@ -436,7 +436,7 @@ if ($resql) {
}
if (!empty($arrayfields['aa.account_parent']['checked'])) {
print '<td class="liste_titre">';
print $formaccounting->select_account($search_accountparent, 'search_accountparent', 2);
print $formaccounting->select_account($search_accountparent, 'search_accountparent', 2, array(), 0, 0, 'maxwidth150');
print '</td>';
}
if (!empty($arrayfields['aa.pcg_type']['checked'])) {

View File

@ -329,7 +329,8 @@ if ($action == 'create') {
// Account parent
print '<tr><td>'.$langs->trans("Accountparent").'</td>';
print '<td>';
print $formaccounting->select_account($object->account_parent, 'account_parent', 1);
// Note: We accept disabled account as parent account so we can build a hierarchy and use only childs
print $formaccounting->select_account($object->account_parent, 'account_parent', 1, array(), 0, 0, 'minwidth100 maxwidth300 maxwidthonsmartphone', 1, '');
print '</td></tr>';
// Chart of accounts type

View File

@ -110,18 +110,22 @@ print '<table class="border centpercent">';
// Select the category
print '<tr><td class="titlefield">'.$langs->trans("AccountingCategory").'</td>';
print '<td>';
$formaccounting->select_accounting_category($cat_id, 'account_category', 1, 0, 0, 1);
print '<input type="submit" class="button" value="'.$langs->trans("Select").'">';
$formaccounting->select_accounting_category($cat_id, 'account_category', 1, 0, 0, 0);
print '<input type="submit" class="button small" value="'.$langs->trans("Select").'">';
print '</td></tr>';
print '</table>';
print dol_get_fiche_end();
// Select the accounts
if (!empty($cat_id)) {
$return = $accountingcategory->getAccountsWithNoCategory($cat_id);
if ($return < 0) {
setEventMessages(null, $accountingcategory->errors, 'errors');
}
print '<tr><td>'.$langs->trans("AddAccountFromBookKeepingWithNoCategories").'</td>';
print '<td>';
print '<br>';
$arraykeyvalue = array();
foreach ($accountingcategory->lines_cptbk as $key => $val) {
@ -130,8 +134,9 @@ if (!empty($cat_id)) {
}
if (is_array($accountingcategory->lines_cptbk) && count($accountingcategory->lines_cptbk) > 0) {
print $form->multiselectarray('cpt_bk', $arraykeyvalue, GETPOST('cpt_bk', 'array'), null, null, null, null, "90%");
print '<br>';
print img_picto($langs->trans("AccountingAccount"), 'accounting_account', 'class="pictofixedwith"');
print $form->multiselectarray('cpt_bk', $arraykeyvalue, GETPOST('cpt_bk', 'array'), null, null, '', 0, "80%", '', '', $langs->transnoentitiesnoconv("AddAccountFromBookKeepingWithNoCategories"));
//print '<br>';
/*print '<select class="flat minwidth200" size="8" name="cpt_bk[]" multiple>';
foreach ( $accountingcategory->lines_cptbk as $cpt ) {
print '<option value="' . length_accountg($cpt->numero_compte) . '">' . length_accountg($cpt->numero_compte) . ' (' . $cpt->label_compte . ' ' . $cpt->doc_ref . ')</option>';
@ -139,20 +144,16 @@ if (!empty($cat_id)) {
print '</select><br>';
print ajax_combobox('cpt_bk');
*/
print '<input type="submit" class="button button-add" id="" class="action-delete" value="'.$langs->trans("Add").'"> ';
print '<input type="submit" class="button button-add small" id="" class="action-delete" value="'.$langs->trans("Add").'"> ';
}
print '</td></tr>';
}
print '</table>';
print dol_get_fiche_end();
print '</form>';
if ($action == 'display' || $action == 'delete') {
print "<table class='noborder' width='100%'>\n";
print '<br>';
print '<table class="noborder centpercent">'."\n";
print '<tr class="liste_titre">';
print '<td class="liste_titre">'.$langs->trans("AccountAccounting")."</td>";
print '<td class="liste_titre" colspan="2">'.$langs->trans("Label")."</td>";
@ -177,6 +178,8 @@ if ($action == 'display' || $action == 'delete') {
print "</td>";
print "</tr>\n";
}
} else {
print '<tr><td colspan="3"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
}
}

View File

@ -190,7 +190,7 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) {
setEventMessages($langs->transnoentities('ErrorCodeCantContainZero'), null, 'errors');
}
}
if (!is_numeric(GETPOST('position', 'alpha'))) {
if (GETPOST('position') && !is_numeric(GETPOST('position', 'alpha'))) {
$langs->loadLangs(array("errors"));
$ok = 0;
setEventMessages($langs->transnoentities('ErrorFieldMustBeANumeric', $langs->transnoentities("Position")), null, 'errors');
@ -605,7 +605,7 @@ if ($resql) {
if ($showfield) {
if ($value == 'country') {
print '<td class="liste_titre">';
print $form->select_country($search_country_id, 'search_country_id', '', 28, 'maxwidth200 maxwidthonsmartphone');
print $form->select_country($search_country_id, 'search_country_id', '', 28, 'maxwidth150 maxwidthonsmartphone');
print '</td>';
$filterfound++;
} else {
@ -725,11 +725,11 @@ if ($resql) {
print '<td></td>';
print '<td></td>';
print '<td class="center">';
print '<div name="'.(!empty($obj->rowid) ? $obj->rowid : $obj->code).'"></div>';
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="rowid" value="'.$rowid.'">';
print '<input type="submit" class="button button-edit" name="actionmodify" value="'.$langs->trans("Modify").'">';
print '<div name="'.(!empty($obj->rowid) ? $obj->rowid : $obj->code).'"></div>';
print '<input type="submit" class="button button-cancel" name="actioncancel" value="'.$langs->trans("Cancel").'">';
print '<input type="submit" class="button button-edit smallpaddingimp" name="actionmodify" value="'.$langs->trans("Modify").'">';
print '<input type="submit" class="button button-cancel smallpaddingimp" name="actioncancel" value="'.$langs->trans("Cancel").'">';
print '</td>';
print '<td></td>';
} else {
@ -887,10 +887,10 @@ function fieldListAccountingCategories($fieldlist, $obj = '', $tabname = '', $co
if ($context == 'add') {
$fieldname = 'country_id';
$preselectcountrycode = GETPOSTISSET('country_id') ? GETPOST('country_id', 'int') : $mysoc->country_code;
print $form->select_country($preselectcountrycode, $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone');
print $form->select_country($preselectcountrycode, $fieldname, '', 28, 'maxwidth150 maxwidthonsmartphone');
} else {
$preselectcountrycode = (empty($obj->country_code) ? (empty($obj->country) ? $mysoc->country_code : $obj->country) : $obj->country_code);
print $form->select_country($preselectcountrycode, $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone');
print $form->select_country($preselectcountrycode, $fieldname, '', 28, 'maxwidth150 maxwidthonsmartphone');
}
print '</td>';
} elseif ($fieldlist[$field] == 'country_id') {

View File

@ -408,7 +408,7 @@ if ($resql) {
$s .= '<a class="vendor-back" style="padding-left: 6px; padding-right: 6px" title="'.$langs->trans("Supplier").'" href="'.DOL_URL_ROOT.'/fourn/card.php?socid='.$obj->rowid.'">'.$langs->trans("Supplier").'</a>';
} elseif ($obj->type == 3) {
// User
$s .= '<a class="user-back" style="padding-left: 6px; padding-right: 6px" title="'.$langs->trans("Employee").'" href="'.DOL_URL_ROOT.'/user/card.php?id='.$obj->id.'">'.$langs->trans("Employee").'</a>';
$s .= '<a class="user-back" style="padding-left: 6px; padding-right: 6px" title="'.$langs->trans("Employee").'" href="'.DOL_URL_ROOT.'/user/card.php?id='.$obj->rowid.'">'.$langs->trans("Employee").'</a>';
}
print $s;
print '</td>';

View File

@ -617,6 +617,7 @@ if ($action == 'create') {
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
} else {
// List of movements
print load_fiche_titre($langs->trans("ListeMvts"), '', '');
print '<form action="'.$_SERVER["PHP_SELF"].'?piece_num='.$object->piece_num.'" method="post">';
@ -664,14 +665,14 @@ if ($action == 'create') {
}
foreach ($object->linesmvt as $line) {
print '<tr class="oddeven">';
print '<tr class="oddeven" data-lineid="'.((int) $line->id).'">';
$total_debit += $line->debit;
$total_credit += $line->credit;
if ($action == 'update' && $line->id == $id) {
print '<!-- td columns in edit mode -->';
print '<td>';
print $formaccounting->select_account((GETPOSTISSET("accountingaccount_number") ? GETPOST("accountingaccount_number", "alpha") : $line->numero_compte), 'accountingaccount_number', 1, array(), 1, 1, '');
print $formaccounting->select_account((GETPOSTISSET("accountingaccount_number") ? GETPOST("accountingaccount_number", "alpha") : $line->numero_compte), 'accountingaccount_number', 1, array(), 1, 1, 'minwidth200 maxwidth500');
print '</td>';
print '<td>';
// TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because:
@ -697,7 +698,7 @@ if ($action == 'create') {
if ($action == "" || $action == 'add') {
print '<!-- td columns in add mode -->';
print '<td>';
print $formaccounting->select_account('', 'accountingaccount_number', 1, array(), 1, 1, '');
print $formaccounting->select_account('', 'accountingaccount_number', 1, array(), 1, 1, 'minwidth200 maxwidth500');
print '</td>';
print '<td>';
// TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because:
@ -714,7 +715,7 @@ if ($action == 'create') {
print '<td><input type="text" class="minwidth200" name="label_operation" value="' . $label_operation . '"/></td>';
print '<td class="right"><input type="text" size="6" class="right" name="debit" value=""/></td>';
print '<td class="right"><input type="text" size="6" class="right" name="credit" value=""/></td>';
print '<td class="center"><input type="submit" class="button" name="save" value="' . $langs->trans("Add") . '"></td>';
print '<td class="center"><input type="submit" class="button small" name="save" value="' . $langs->trans("Add") . '"></td>';
}
} else {
print '<!-- td columns in display mode -->';
@ -732,8 +733,8 @@ if ($action == 'create') {
}
print '</td>';
print '<td>'.$line->label_operation.'</td>';
print '<td class="right nowraponall amount">'.price($line->debit).'</td>';
print '<td class="right nowraponall amount">'.price($line->credit).'</td>';
print '<td class="right nowraponall amount">'.($line->debit != 0 ? price($line->debit) : '').'</td>';
print '<td class="right nowraponall amount">'.($line->credit != 0 ? price($line->credit) : '').'</td>';
print '<td class="center nowraponall">';
if (empty($line->date_export) && empty($line->date_validation)) {

View File

@ -942,7 +942,7 @@ if (count($filter)) {
$buttonLabel = $langs->trans("ExportList");
}
$parameters = array();
$parameters = array('param' => $param);
$reshook = $hookmanager->executeHooks('addMoreActionsButtonsList', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');

View File

@ -642,7 +642,7 @@ print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
$parameters = array();
$parameters = array('param' => $param);
$reshook = $hookmanager->executeHooks('addMoreActionsButtonsList', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
@ -844,7 +844,7 @@ if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
}
if (!empty($arrayfields['t.piece_num']['checked'])) {
print_liste_field_titre($arrayfields['t.piece_num']['label'], $_SERVER['PHP_SELF'], "t.piece_num", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($arrayfields['t.piece_num']['label'], $_SERVER['PHP_SELF'], "t.piece_num", "", $param, '', $sortfield, $sortorder, 'tdoverflowmax80imp ');
}
if (!empty($arrayfields['t.code_journal']['checked'])) {
print_liste_field_titre($arrayfields['t.code_journal']['label'], $_SERVER['PHP_SELF'], "t.code_journal", "", $param, '', $sortfield, $sortorder, 'center ');
@ -1024,7 +1024,7 @@ while ($i < min($num, $limit)) {
$accountingjournal = new AccountingJournal($db);
$result = $accountingjournal->fetch('', $line->code_journal);
$journaltoshow = (($result > 0) ? $accountingjournal->getNomUrl(0, 0, 0, '', 0) : $line->code_journal);
print '<td class="center">'.$journaltoshow.'</td>';
print '<td class="center tdoverflowmax80">'.$journaltoshow.'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
@ -1120,7 +1120,7 @@ while ($i < min($num, $limit)) {
// Amount debit
if (!empty($arrayfields['t.debit']['checked'])) {
print '<td class="right nowraponall amount">'.($line->debit ? price($line->debit) : '').'</td>';
print '<td class="right nowraponall amount">'.($line->debit != 0 ? price($line->debit) : '').'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
@ -1132,7 +1132,7 @@ while ($i < min($num, $limit)) {
// Amount credit
if (!empty($arrayfields['t.credit']['checked'])) {
print '<td class="right nowraponall amount">'.($line->credit ? price($line->credit) : '').'</td>';
print '<td class="right nowraponall amount">'.($line->credit != 0 ? price($line->credit) : '').'</td>';
if (!$i) {
$totalarray['nbfield']++;
}

View File

@ -452,56 +452,6 @@ class AccountancyCategory // extends CommonObject
}
}
/**
* Function to fill ->lines_cptbk with accounting account used (into bookkeeping) and not yet into a custom group
*
* @param int $id Id of custom group
* @return int <0 if KO, 0 if not found, >0 if OK
*/
/*
public function getCptBK($id)
{
global $conf;
$sql = "SELECT DISTINCT t.numero_compte, t.label_operation, t.doc_ref";
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as t";
$sql .= " WHERE t.numero_compte NOT IN ("; // account not into a custom group
$sql .= " SELECT t.account_number";
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as t";
$sql .= " WHERE t.fk_accounting_category = ".((int) $id)." AND t.entity = ".$conf->entity.")";
$sql .= " AND t.numero_compte IN ("; // account into current chart of account
$sql .= " SELECT DISTINCT aa.account_number";
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as aa";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
$sql .= " AND asy.rowid = ".((int) $conf->global->CHARTOFACCOUNTS);
$sql .= " AND aa.active = 1";
$sql .= " AND aa.entity = ".$conf->entity.")";
$sql .= " GROUP BY t.numero_compte, t.label_operation, t.doc_ref";
$sql .= " ORDER BY t.numero_compte";
$this->lines_cptbk = array();
dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
$num = $this->db->num_rows($resql);
if ($num) {
while ($obj = $this->db->fetch_object($resql)) {
$this->lines_cptbk[] = $obj;
}
}
return $num;
} else {
$this->error = "Error ".$this->db->lasterror();
$this->errors[] = $this->error;
dol_syslog(__METHOD__." ".implode(','.$this->errors), LOG_ERR);
return -1;
}
}
*/
/**
* Function to fill ->lines_cptbk with accounting account (defined in chart of account) and not yet into a custom group
*
@ -743,7 +693,7 @@ class AccountancyCategory // extends CommonObject
}
$listofaccount .= "'".$cptcursor."'";
}
$sql .= " AND t.numero_compte IN (".$this->db->sanitize($listofaccount).")";
$sql .= " AND t.numero_compte IN (".$this->db->sanitize($listofaccount, 1).")";
} else {
$sql .= " AND t.numero_compte = '".$this->db->escape($cpt)."'";
}

View File

@ -189,7 +189,7 @@ print '<script type="text/javascript">
/*
* Customer Invoice lines
*/
$sql = "SELECT f.rowid as facid, f.ref as ref, f.type, f.datef, f.ref_client,";
$sql = "SELECT f.rowid as facid, f.ref as ref, f.type as ftype, f.datef, f.ref_client,";
$sql .= " fd.rowid, fd.description, fd.product_type as line_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.vat_src_code, fd.total_ttc,";
$sql .= " s.rowid as socid, s.nom as name, s.code_client,";
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
@ -199,7 +199,7 @@ if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
$sql .= " s.code_compta as code_compta_client,";
$sql .= " s.code_compta_fournisseur,";
}
$sql .= " p.rowid as product_id, p.fk_product_type as product_type, p.ref as product_ref, p.label as product_label,";
$sql .= " p.rowid as product_id, p.fk_product_type as product_type, p.ref as product_ref, p.label as product_label, p.tobuy, p.tosell,";
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
$sql .= " ppe.accountancy_code_sell, ppe.accountancy_code_sell_intra, ppe.accountancy_code_sell_export,";
} else {
@ -529,6 +529,10 @@ if ($result) {
print '</tr>';
$i++;
}
if ($num_lines == 0) {
print '<tr><td colspan="12"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
}
print '</table>';
print "</div>";

View File

@ -496,7 +496,7 @@ if ($result) {
print '<td class="liste_titre right"><input type="text" class="flat maxwidth50 right" name="search_vat" placeholder="%" size="1" value="'.dol_escape_htmltag($search_vat).'"></td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth75imp" name="search_societe" value="'.dol_escape_htmltag($search_societe).'"></td>';
print '<td class="liste_titre">';
print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth125', 'code2', 1, 0, 1, null, 1);
print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth100', 'code2', 1, 0, 1);
//print '<input type="text" class="flat maxwidth50" name="search_country" value="' . dol_escape_htmltag($search_country) . '">';
print '</td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_tvaintra" value="'.dol_escape_htmltag($search_tvaintra).'"></td>';
@ -749,6 +749,10 @@ if ($result) {
print '</tr>';
$i++;
}
if ($num_lines == 0) {
print '<tr><td colspan="13"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
}
print '</table>';
print "</div>";

View File

@ -427,6 +427,13 @@ if ($result) {
print "</tr>";
$i++;
}
if ($num_lines == 0) {
$colspan=10;
if (!empty($conf->global->ACCOUNTANCY_USE_EXPENSE_REPORT_VALIDATION_DATE)) {
$colspan++;
}
print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
}
print "</table>";
print "</div>";

View File

@ -513,6 +513,9 @@ if ($result) {
print "</tr>";
$i++;
}
if ($num_lines == 0) {
print '<tr><td colspan="13"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
}
print '</table>';
print "</div>";

View File

@ -4,7 +4,7 @@
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2013-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2013-2022 Open-DSI <support@open-dsi.fr>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2017-2021 Frédéric France <frederic.france@netlogic.fr>
@ -1227,22 +1227,22 @@ if (empty($action) || $action == 'view') {
$account_ledger = $k;
// Try to force general ledger account depending on type
if ($tabtype[$key] == 'payment') {
$account_ledger = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
$account_ledger = getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER');
}
if ($tabtype[$key] == 'payment_supplier') {
$account_ledger = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
$account_ledger = getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER');
}
if ($tabtype[$key] == 'payment_expensereport') {
$account_ledger = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
$account_ledger = getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT');
}
if ($tabtype[$key] == 'payment_salary') {
$account_ledger = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
$account_ledger = getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT');
}
if ($tabtype[$key] == 'payment_vat') {
$account_ledger = $conf->global->ACCOUNTING_VAT_PAY_ACCOUNT;
$account_ledger = getDolGlobalString('ACCOUNTING_VAT_PAY_ACCOUNT');
}
if ($tabtype[$key] == 'member') {
$account_ledger = $conf->global->ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT;
$account_ledger = getDolGlobalString('ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT');
}
if ($tabtype[$key] == 'payment_various') {
$account_ledger = $tabpay[$key]["account_various"];
@ -1281,7 +1281,7 @@ if (empty($action) || $action == 'view') {
}
}
print '<td class="maxwidth300" title="'.dol_escape_htmltag(dol_string_nohtmltag($accounttoshow)).'">';
print $accounttoshow;
print $accounttoshow; // This is a HTML string
print "</td>";
// Subledger account
@ -1310,7 +1310,7 @@ if (empty($action) || $action == 'view') {
}
}
print '<td class="maxwidth300">';
print $accounttoshowsubledger;
print $accounttoshowsubledger; // This is a html string
print "</td>";
print "<td>".$reflabel."</td>";
@ -1415,9 +1415,19 @@ function getSourceDocRef($val, $typerecord)
$sqlmid = '';
if ($typerecord == 'payment') {
$sqlmid = 'SELECT payfac.fk_facture as id, f.ref as ref';
$sqlmid .= " FROM ".MAIN_DB_PREFIX."paiement_facture as payfac, ".MAIN_DB_PREFIX."facture as f";
$sqlmid .= " WHERE payfac.fk_facture = f.rowid AND payfac.fk_paiement=".((int) $val["paymentid"]);
if (getDolGlobalInt('FACTURE_DEPOSITS_ARE_JUST_PAYMENTS')) {
$sqlmid = "SELECT payfac.fk_facture as id, ".$db->ifsql('f1.rowid IS NULL', 'f.ref', 'f1.ref')." as ref";
$sqlmid .= " FROM ".$db->prefix()."paiement_facture as payfac";
$sqlmid .= " LEFT JOIN ".$db->prefix()."facture as f ON f.rowid = payfac.fk_facture";
$sqlmid .= " LEFT JOIN ".$db->prefix()."societe_remise_except as sre ON sre.fk_facture_source = payfac.fk_facture";
$sqlmid .= " LEFT JOIN ".$db->prefix()."facture as f1 ON f1.rowid = sre.fk_facture";
$sqlmid .= " WHERE payfac.fk_paiement=".((int) $val['paymentid']);
} else {
$sqlmid = "SELECT payfac.fk_facture as id, f.ref as ref";
$sqlmid .= " FROM ".$db->prefix()."paiement_facture as payfac";
$sqlmid .= " INNER JOIN ".$db->prefix()."facture as f ON f.rowid = payfac.fk_facture";
$sqlmid .= " WHERE payfac.fk_paiement=".((int) $val['paymentid']);
}
$ref = $langs->transnoentitiesnoconv("Invoice");
} elseif ($typerecord == 'payment_supplier') {
$sqlmid = 'SELECT payfac.fk_facturefourn as id, f.ref';

View File

@ -49,7 +49,7 @@ $search_societe = GETPOST('search_societe', 'alpha');
$search_lineid = GETPOST('search_lineid', 'int');
$search_ref = GETPOST('search_ref', 'alpha');
$search_invoice = GETPOST('search_invoice', 'alpha');
$search_ref_supplier = GETPOST('search_ref_supplier', 'alpha');
//$search_ref_supplier = GETPOST('search_ref_supplier', 'alpha');
$search_label = GETPOST('search_label', 'alpha');
$search_desc = GETPOST('search_desc', 'alpha');
$search_amount = GETPOST('search_amount', 'alpha');
@ -113,7 +113,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
$search_lineid = '';
$search_ref = '';
$search_invoice = '';
$search_ref_supplier = '';
//$search_ref_supplier = '';
$search_label = '';
$search_desc = '';
$search_amount = '';
@ -194,9 +194,9 @@ print '<script type="text/javascript">
/*
* Supplier Invoice lines
*/
$sql = "SELECT f.rowid as facid, f.ref as ref, f.ref_supplier, f.libelle as invoice_label, f.datef, f.fk_soc,";
$sql = "SELECT f.rowid as facid, f.ref as ref, f.ref_supplier, f.type as ftype, f.libelle as invoice_label, f.datef, f.fk_soc,";
$sql .= " l.rowid, l.fk_product, l.product_type as line_type, l.description, l.total_ht , l.qty, l.tva_tx, l.vat_src_code,";
$sql .= " aa.label as label_account, aa.labelshort as labelshort_account, aa.account_number,";
$sql .= " aa.rowid as fk_compte, aa.label as label_account, aa.labelshort as labelshort_account, aa.account_number,";
$sql .= " p.rowid as product_id, p.fk_product_type as product_type, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.tobuy, p.tosell,";
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
$sql .= " ppe.accountancy_code_buy, ppe.accountancy_code_buy_intra, ppe.accountancy_code_buy_export,";
@ -236,11 +236,11 @@ if ($search_lineid) {
$sql .= natural_search("l.rowid", $search_lineid, 1);
}
if (strlen(trim($search_invoice))) {
$sql .= natural_search("f.ref", $search_invoice);
$sql .= natural_search(array("f.ref", "f.ref_supplier"), $search_invoice);
}
if (strlen(trim($search_ref_supplier))) {
/*if (strlen(trim($search_ref_supplier))) {
$sql .= natural_search("f.ref_supplier", $search_ref_supplier);
}
}*/
if (strlen(trim($search_label))) {
$sql .= natural_search("f.libelle", $search_label);
}
@ -333,9 +333,9 @@ if ($result) {
if ($search_ref) {
$param .= "&search_ref=".urlencode($search_ref);
}
if ($search_ref_supplier) {
/*if ($search_ref_supplier) {
$param .= '&search_ref_supplier='.urlencode($search_ref_supplier);
}
}*/
if ($search_label) {
$param .= "&search_label=".urlencode($search_label);
}
@ -400,7 +400,7 @@ if ($result) {
print '<tr class="liste_titre_filter">';
print '<td class="liste_titre"><input type="text" class="flat maxwidth25" name="search_lineid" value="'.dol_escape_htmltag($search_lineid).'"></td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_invoice" value="'.dol_escape_htmltag($search_invoice).'"></td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_ref_supplier" value="'.dol_escape_htmltag($search_ref_supplier).'"></td>';
//print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_ref_supplier" value="'.dol_escape_htmltag($search_ref_supplier).'"></td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="'.dol_escape_htmltag($search_label).'"></td>';
print '<td class="liste_titre center">';
print '<div class="nowrap">';
@ -416,11 +416,11 @@ if ($result) {
print '<td class="liste_titre right"><input type="text" class="right flat maxwidth50" name="search_vat" placeholder="%" size="1" value="'.dol_escape_htmltag($search_vat).'"></td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth75imp" name="search_societe" value="'.dol_escape_htmltag($search_societe).'"></td>';
print '<td class="liste_titre">';
print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth150', 'code2', 1, 0, 1);
print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth100', 'code2', 1, 0, 1);
// print '<input type="text" class="flat maxwidth50" name="search_country" value="' . dol_escape_htmltag($search_country) . '">';
print '</td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_tvaintra" value="'.dol_escape_htmltag($search_tvaintra).'"></td>';
print '<td class="liste_titre center"><input type="text" class="flat maxwidth50" name="search_account" value="'.dol_escape_htmltag($search_account).'"></td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_account" value="'.dol_escape_htmltag($search_account).'"></td>';
print '<td class="liste_titre center">';
$searchpicto = $form->showFilterButtons();
print $searchpicto;
@ -429,7 +429,7 @@ if ($result) {
print '<tr class="liste_titre">';
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("RefSupplier", $_SERVER["PHP_SELF"], "f.ref_supplier", "", $param, '', $sortfield, $sortorder);
//print_liste_field_titre("RefSupplier", $_SERVER["PHP_SELF"], "f.ref_supplier", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("InvoiceLabel", $_SERVER["PHP_SELF"], "f.libelle", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
@ -478,8 +478,8 @@ if ($result) {
$productstatic->status = $objp->tosell;
$productstatic->status_buy = $objp->tobuy;
$productstatic->accountancy_code_buy = $objp->accountancy_code_buy;
$productstatic->accountancy_code_buy_intra = $objp->accountancy_code_sell_buy_intra;
$productstatic->accountancy_code_buy_export = $objp->accountancy_code_sell_buy_export;
$productstatic->accountancy_code_buy_intra = $objp->accountancy_code_buy_intra;
$productstatic->accountancy_code_buy_export = $objp->accountancy_code_buy_export;
$accountingaccountstatic->rowid = $objp->fk_compte;
$accountingaccountstatic->label = $objp->label_account;
@ -492,12 +492,18 @@ if ($result) {
print '<td>'.$objp->rowid.'</td>';
// Ref Invoice
print '<td class="nowraponall">'.$facturefournisseur_static->getNomUrl(1).'</td>';
print '<td class="nowraponall">'.$facturefournisseur_static->getNomUrl(1);
if ($objp->ref_supplier) {
print '<br><span class="opacitymedium small">'.dol_escape_htmltag($objp->ref_supplier).'</span>';
}
print '</td>';
// Ref supplier invoice
/*
print '<td class="tdoverflowmax100" title="'.dol_escape_htmltag($objp->ref_supplier).'">';
print $objp->ref_supplier;
print '</td>';
*/
// Supplier invoice label
print '<td class="tdoverflowonsmartphone small" title="'.dol_escape_htmltag($objp->invoice_label).'">';
@ -552,6 +558,10 @@ if ($result) {
print '</tr>';
$i++;
}
if ($num_lines == 0) {
print '<tr><td colspan="13"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
}
print '</table>';
print "</div>";

View File

@ -289,14 +289,14 @@ if ($search_lineid) {
$sql .= natural_search("l.rowid", $search_lineid, 1);
}
if (strlen(trim($search_invoice))) {
$sql .= natural_search("f.ref", $search_invoice);
$sql .= natural_search(array("f.ref", "f.ref_supplier"), $search_invoice);
}
if (strlen(trim($search_ref))) {
$sql .= natural_search("p.ref", $search_ref);
}
if (strlen(trim($search_ref_supplier))) {
/*if (strlen(trim($search_ref_supplier))) {
$sql .= natural_search("f.ref_supplier", $search_ref_supplier);
}
}*/
if (strlen(trim($search_label))) {
$sql .= natural_search(array("p.label", "f.libelle"), $search_label);
}
@ -490,7 +490,7 @@ if ($result) {
print '<tr class="liste_titre_filter">';
print '<td class="liste_titre"><input type="text" class="flat maxwidth25" name="search_lineid" value="'.dol_escape_htmltag($search_lineid).'"></td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_invoice" value="'.dol_escape_htmltag($search_invoice).'"></td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_ref_supplier" value="'.dol_escape_htmltag($search_ref_supplier).'"></td>';
//print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_ref_supplier" value="'.dol_escape_htmltag($search_ref_supplier).'"></td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="'.dol_escape_htmltag($search_label).'"></td>';
print '<td class="liste_titre center">';
print '<div class="nowrap">';
@ -506,7 +506,7 @@ if ($result) {
print '<td class="liste_titre right"><input type="text" class="flat maxwidth50 right" name="search_vat" placeholder="%" size="1" value="'.dol_escape_htmltag($search_vat).'"></td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth75imp" name="search_societe" value="'.dol_escape_htmltag($search_societe).'"></td>';
print '<td class="liste_titre">';
print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth125', 'code2', 1, 0, 1, null, 1);
print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth100', 'code2', 1, 0, 1);
//print '<input type="text" class="flat maxwidth50" name="search_country" value="' . dol_escape_htmltag($search_country) . '">';
print '</td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_tvaintra" value="'.dol_escape_htmltag($search_tvaintra).'"></td>';
@ -521,7 +521,7 @@ if ($result) {
print '<tr class="liste_titre">';
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("RefSupplier", $_SERVER["PHP_SELF"], "f.ref_supplier", "", $param, '', $sortfield, $sortorder);
//print_liste_field_titre("RefSupplier", $_SERVER["PHP_SELF"], "f.ref_supplier", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("InvoiceLabel", $_SERVER["PHP_SELF"], "f.libelle", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
@ -648,16 +648,20 @@ if ($result) {
print '<td>'.$facturefourn_static_det->id.'</td>';
// Ref Invoice
print '<td class="nowraponall">'.$facturefourn_static->getNomUrl(1).'</td>';
// Ref supplier invoice
print '<td class="tdoverflowmax100" title="'.dol_escape_htmltag($objp->ref_supplier).'">';
print $objp->ref_supplier;
print '<td class="nowraponall">'.$facturefourn_static->getNomUrl(1);
if ($objp->ref_supplier) {
print '<br><span class="opacitymedium small">'.dol_escape_htmltag($objp->ref_supplier).'</span>';
}
print '</td>';
// Ref supplier invoice
/*print '<td class="tdoverflowmax100" title="'.dol_escape_htmltag($objp->ref_supplier).'">';
print $objp->ref_supplier;
print '</td>';*/
// Supplier invoice label
print '<td class="tdoverflowmax125 small" title="'.dol_escape_htmltag($objp->invoice_label).'">';
print $objp->invoice_label;
print '<td class="tdoverflowmax100 small" title="'.dol_escape_htmltag($objp->invoice_label).'">';
print dol_escape_htmltag($objp->invoice_label);
print '</td>';
// Date
@ -669,11 +673,11 @@ if ($result) {
print $product_static->getNomUrl(1);
}
if ($product_static->label) {
print '<br><span class="opacitymedium small">'.$product_static->label.'</span>';
print '<br><span class="opacitymedium small">'.dol_escape_htmltag($product_static->label).'</span>';
}
print '</td>';
// Description
// Description of line
print '<td class="tdoverflowonsmartphone small">';
$text = dolGetFirstLineOfText(dol_string_nohtmltag($facturefourn_static_det->desc, 1));
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
@ -686,11 +690,11 @@ if ($result) {
// Vat rate
$code_vat_differ = '';
if ($objp->vat_tx_l != $objp->vat_tx_p && price2num($objp->vat_tx_p) && price2num($objp->vat_tx_l)) { // Note: having a vat rate of 0 is often the normal case when sells is intra b2b or to export
$code_vat_differ = 'warning bold';
}
//if ($objp->vat_tx_l != $objp->vat_tx_p && price2num($objp->vat_tx_p) && price2num($objp->vat_tx_l)) { // Note: having a vat rate of 0 is often the normal case when sells is intra b2b or to export
// $code_vat_differ = 'warning bold';
//}
print '<td class="right'.($code_vat_differ?' '.$code_vat_differ:'').'">';
print vatrate($facturefourn_static_det->tva_tx.($facturefourn_static_det->vat_src_code ? ' ('.$facturefourn_static_det->vat_src_code.')' : ''));
print vatrate($facturefourn_static_det->tva_tx.($facturefourn_static_det->vat_src_code ? ' ('.$facturefourn_static_det->vat_src_code.')' : ''), false, 0, 0, 1);
print '</td>';
// Thirdparty
@ -773,6 +777,9 @@ if ($result) {
print '</tr>';
$i++;
}
if ($num_lines == 0) {
print '<tr><td colspan="14"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
}
print '</table>';
print "</div>";

View File

@ -152,10 +152,13 @@ if ($action == 'set_default') {
setEventMessages('RecordModifiedSuccessfully', null, 'mesgs');
$db->commit();
}
}
// Action to update or add a constant
if ($action == 'update' || $action == 'add') {
} elseif ($action == 'setcodemember') {
$result = dolibarr_set_const($db, "MEMBER_CODEMEMBER_ADDON", $value, 'chaine', 0, '', $conf->entity);
if ($result <= 0) {
dol_print_error($db);
}
} elseif ($action == 'update' || $action == 'add') {
// Action to update or add a constant
$constname = GETPOST('constname', 'alpha');
$constvalue = (GETPOST('constvalue_'.$constname) ? GETPOST('constvalue_'.$constname) : GETPOST('constvalue'));
@ -223,6 +226,97 @@ $head = member_admin_prepare_head();
print dol_get_fiche_head($head, 'general', $langs->trans("Members"), -1, 'user');
$dirModMember = array_merge(array('/core/modules/member/'), $conf->modules_parts['member']);
foreach ($conf->modules_parts['models'] as $mo) {
//Add more models
$dirModMember[] = $mo.'core/modules/member/';
}
// Module to manage customer/supplier code
print load_fiche_titre($langs->trans("MemberCodeChecker"), '', '');
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">'."\n";
print '<tr class="liste_titre">'."\n";
print ' <td>'.$langs->trans("Name").'</td>';
print ' <td>'.$langs->trans("Description").'</td>';
print ' <td>'.$langs->trans("Example").'</td>';
print ' <td class="center" width="80">'.$langs->trans("Status").'</td>';
print ' <td class="center" width="60">'.$langs->trans("ShortInfo").'</td>';
print "</tr>\n";
$arrayofmodules = array();
foreach ($dirModMember as $dirroot) {
$dir = dol_buildpath($dirroot, 0);
$handle = @opendir($dir);
if (is_resource($handle)) {
// Loop on each module find in opened directory
while (($file = readdir($handle)) !== false) {
// module filename has to start with mod_member_
if (substr($file, 0, 11) == 'mod_member_' && substr($file, -3) == 'php') {
$file = substr($file, 0, dol_strlen($file) - 4);
try {
dol_include_once($dirroot.$file.'.php');
} catch (Exception $e) {
dol_syslog($e->getMessage(), LOG_ERR);
continue;
}
$modCodeMember = new $file;
// Show modules according to features level
if ($modCodeMember->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) {
continue;
}
if ($modCodeMember->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) {
continue;
}
$arrayofmodules[$file] = $modCodeMember;
}
}
closedir($handle);
}
}
$arrayofmodules = dol_sort_array($arrayofmodules, 'position');
foreach ($arrayofmodules as $file => $modCodeMember) {
print '<tr class="oddeven">'."\n";
print '<td width="140">'.$modCodeMember->name.'</td>'."\n";
print '<td>'.$modCodeMember->info($langs).'</td>'."\n";
print '<td class="nowrap">'.$modCodeMember->getExample($langs).'</td>'."\n";
if (getDolGlobalString('MEMBER_CODEMEMBER_ADDON') == "$file") {
print '<td class="center">'."\n";
print img_picto($langs->trans("Activated"), 'switch_on');
print "</td>\n";
} else {
$disabled = (isModEnabled('multicompany') && (is_object($mc) && !empty($mc->sharings['referent']) && $mc->sharings['referent'] != $conf->entity) ? true : false);
print '<td class="center">';
if (!$disabled) {
print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setcodemember&token='.newToken().'&value='.urlencode($file).'">';
}
print img_picto($langs->trans("Disabled"), 'switch_off');
if (!$disabled) {
print '</a>';
}
print '</td>';
}
print '<td class="center">';
$s = $modCodeMember->getToolTip($langs, null, -1);
print $form->textwithpicto('', $s, 1);
print '</td>';
print '</tr>';
}
print '</table>';
print '</div>';
print "<br>";
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="updatemainoptions">';

View File

@ -234,7 +234,7 @@ if (!empty($conf->global->MEMBER_ENABLE_PUBLIC)) {
// Can edit
print '<tr class="oddeven" id="tredit"><td>';
print $langs->trans("CanEditAmount");
print $langs->trans("CanEditAmountDetail");
print '</td><td>';
print $form->selectyesno("MEMBER_NEWFORM_EDITAMOUNT", (!empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT) ? $conf->global->MEMBER_NEWFORM_EDITAMOUNT : 0), 1);
print "</td></tr>\n";

View File

@ -112,7 +112,7 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon
$this->tpl['actionsdone'] = show_actions_done($conf, $langs, $db, $objsoc, $this->object, 1);
} else {
// Confirm delete contact
if ($action == 'delete' && $user->rights->adherent->supprimer) {
if ($action == 'delete' && $user->hasRight('adherent', 'supprimer')) {
$this->tpl['action_delete'] = $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$this->object->id, $langs->trans("DeleteAdherent"), $langs->trans("ConfirmDeleteAdherent"), "confirm_delete", '', 0, 1);
}
}

View File

@ -128,12 +128,12 @@ if (empty($user->socid)) {
echo '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$this->control->tpl['id'].'&action=edit&token='.newToken().'&canvas='.$canvas.'">'.$langs->trans('Modify').'</a>';
}
if (!$this->control->tpl['user_id'] && $user->rights->user->user->creer) {
if (!$this->control->tpl['user_id'] && $user->hasRight('user', 'user', 'creer')) {
echo '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$this->control->tpl['id'].'&action=create_user&token='.newToken().'&canvas='.$canvas.'">'.$langs->trans("CreateDolibarrLogin").'</a>';
}
if ($user->rights->adherent->supprimer) {
print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$this->control->tpl['id'].'&action=delete&token='.newToken().'&canvas='.$canvas, 'delete', $user->rights->adherent->supprimer);
if ($user->hasRight('adherent', 'supprimer')) {
print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$this->control->tpl['id'].'&action=delete&token='.newToken().'&canvas='.$canvas, 'delete', $user->hasRight('adherent', 'supprimer'));
}
echo '</div><br>';

View File

@ -6,7 +6,7 @@
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2012-2020 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2015-2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2022 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2021 Waël Almoman <info@almoman.com>
*
* This program is free software; you can redistribute it and/or modify
@ -305,23 +305,23 @@ if (empty($reshook)) {
$object->phone = trim(GETPOST("phone", 'alpha'));
$object->phone_perso = trim(GETPOST("phone_perso", 'alpha'));
$object->phone_mobile = trim(GETPOST("phone_mobile", 'alpha'));
$object->email = preg_replace('/\s+/', '', GETPOST("member_email", 'alpha'));
$object->url = trim(GETPOST('member_url', 'custom', 0, FILTER_SANITIZE_URL));
$object->email = preg_replace('/\s+/', '', GETPOST("member_email", 'alpha'));
$object->url = trim(GETPOST('member_url', 'custom', 0, FILTER_SANITIZE_URL));
$object->socialnetworks = array();
foreach ($socialnetworks as $key => $value) {
if (GETPOSTISSET($key) && GETPOST($key, 'alphanohtml') != '') {
$object->socialnetworks[$key] = trim(GETPOST($key, 'alphanohtml'));
}
}
//$object->skype = trim(GETPOST("skype", 'alpha'));
//$object->twitter = trim(GETPOST("twitter", 'alpha'));
//$object->facebook = trim(GETPOST("facebook", 'alpha'));
//$object->linkedin = trim(GETPOST("linkedin", 'alpha'));
$object->birth = $birthdate;
//$object->skype = trim(GETPOST("skype", 'alpha'));
//$object->twitter = trim(GETPOST("twitter", 'alpha'));
//$object->facebook = trim(GETPOST("facebook", 'alpha'));
//$object->linkedin = trim(GETPOST("linkedin", 'alpha'));
$object->birth = $birthdate;
$object->default_lang = GETPOST('default_lang', 'alpha');
$object->typeid = GETPOST("typeid", 'int');
//$object->note = trim(GETPOST("comment","alpha"));
$object->morphy = GETPOST("morphy", 'alpha');
$object->typeid = GETPOST("typeid", 'int');
//$object->note = trim(GETPOST("comment","alpha"));
$object->morphy = GETPOST("morphy", 'alpha');
if (GETPOST('deletephoto', 'alpha')) {
$object->photo = '';
@ -330,8 +330,8 @@ if (empty($reshook)) {
}
// Get status and public property
$object->statut = GETPOST("statut", 'alpha');
$object->public = GETPOST("public", 'alpha');
$object->statut = GETPOST("statut", 'alpha');
$object->public = GETPOST("public", 'alpha');
// Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET');
@ -342,7 +342,7 @@ if (empty($reshook)) {
// Check if we need to also synchronize user information
$nosyncuser = 0;
if ($object->user_id) { // If linked to a user
if ($user->id != $object->user_id && empty($user->rights->user->user->creer)) {
if ($user->id != $object->user_id && !$user->hasRight('user', 'user', 'creer')) {
$nosyncuser = 1; // Disable synchronizing
}
}
@ -350,7 +350,7 @@ if (empty($reshook)) {
// Check if we need to also synchronize password information
$nosyncuserpass = 0;
if ($object->user_id) { // If linked to a user
if ($user->id != $object->user_id && empty($user->rights->user->user->password)) {
if ($user->id != $object->user_id && !$user->hasRight('user', 'user', 'password')) {
$nosyncuserpass = 1; // Disable synchronizing
}
}
@ -454,7 +454,7 @@ if (empty($reshook)) {
// $facebook=GETPOST("member_facebook", 'alpha');
// $linkedin=GETPOST("member_linkedin", 'alpha');
$email = preg_replace('/\s+/', '', GETPOST("member_email", 'alpha'));
$url = trim(GETPOST('url', 'custom', 0, FILTER_SANITIZE_URL));
$url = trim(GETPOST('url', 'custom', 0, FILTER_SANITIZE_URL));
$login = GETPOST("member_login", 'alphanohtml');
$pass = GETPOST("password", 'none'); // For password, we use 'none'
$photo = GETPOST("photo", 'alphanohtml');
@ -659,7 +659,7 @@ if (empty($reshook)) {
$outputlangs->loadLangs(array("main", "members", "companies", "install", "other"));
// Get email content from template
$arraydefaultmessage = null;
$labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_MEMBER_VALIDATION;
$labeltouse = getDolGlobalString('ADHERENT_EMAIL_TEMPLATE_MEMBER_VALIDATION');
if (!empty($labeltouse)) {
$arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse);
@ -731,7 +731,7 @@ if (empty($reshook)) {
$outputlangs->loadLangs(array("main", "members", "companies", "install", "other"));
// Get email content from template
$arraydefaultmessage = null;
$labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_CANCELATION;
$labeltouse = getDolGlobalString('ADHERENT_EMAIL_TEMPLATE_CANCELATION');
if (!empty($labeltouse)) {
$arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse);
@ -802,7 +802,7 @@ if (empty($reshook)) {
$outputlangs->loadLangs(array("main", "members", "companies", "install", "other"));
// Get email content from template
$arraydefaultmessage = null;
$labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_EXCLUSION;
$labeltouse = getDolGlobalString('ADHERENT_EMAIL_TEMPLATE_EXCLUSION');
if (!empty($labeltouse)) {
$arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse);
@ -1524,7 +1524,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
$subject = $arraydefaultmessage->topic;
$msg = $arraydefaultmessage->content;
$msg = $arraydefaultmessage->content;
}
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
@ -1533,10 +1533,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
$texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnValid()), $substitutionarray, $outputlangs);
$tmp = $langs->trans("SendingAnEMailToMember");
$tmp .= '<br>'.$langs->trans("MailFrom").': <b>'.$conf->global->ADHERENT_MAIL_FROM.'</b>, ';
$tmp .= '<br>'.$langs->trans("MailFrom").': <b>'.getDolGlobalString('ADHERENT_MAIL_FROM').'</b>, ';
$tmp .= '<br>'.$langs->trans("MailRecipient").': <b>'.$object->email.'</b>';
$helpcontent = '';
$helpcontent .= '<b>'.$langs->trans("MailFrom").'</b>: '.$conf->global->ADHERENT_MAIL_FROM.'<br>'."\n";
$helpcontent .= '<b>'.$langs->trans("MailFrom").'</b>: '.getDolGlobalString('ADHERENT_MAIL_FROM').'<br>'."\n";
$helpcontent .= '<b>'.$langs->trans("MailRecipient").'</b>: '.$object->email.'<br>'."\n";
$helpcontent .= '<b>'.$langs->trans("Subject").'</b>:<br>'."\n";
$helpcontent .= $subjecttosend."\n";
@ -1596,10 +1596,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
$texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnResiliate()), $substitutionarray, $outputlangs);
$tmp = $langs->trans("SendingAnEMailToMember");
$tmp .= '<br>('.$langs->trans("MailFrom").': <b>'.$conf->global->ADHERENT_MAIL_FROM.'</b>, ';
$tmp .= '<br>('.$langs->trans("MailFrom").': <b>'.getDolGlobalString('ADHERENT_MAIL_FROM').'</b>, ';
$tmp .= $langs->trans("MailRecipient").': <b>'.$object->email.'</b>)';
$helpcontent = '';
$helpcontent .= '<b>'.$langs->trans("MailFrom").'</b>: '.$conf->global->ADHERENT_MAIL_FROM.'<br>'."\n";
$helpcontent .= '<b>'.$langs->trans("MailFrom").'</b>: '.getDolGlobalString('ADHERENT_MAIL_FROM').'<br>'."\n";
$helpcontent .= '<b>'.$langs->trans("MailRecipient").'</b>: '.$object->email.'<br>'."\n";
$helpcontent .= '<b>'.$langs->trans("Subject").'</b>:<br>'."\n";
$helpcontent .= $subjecttosend."\n";
@ -1639,7 +1639,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
$outputlangs->loadLangs(array("main", "members"));
// Get email content from template
$arraydefaultmessage = null;
$labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_EXCLUSION;
$labeltouse = getDolGlobalString('ADHERENT_EMAIL_TEMPLATE_EXCLUSION');
if (!empty($labeltouse)) {
$arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse);
@ -1656,10 +1656,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
$texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnExclude()), $substitutionarray, $outputlangs);
$tmp = $langs->trans("SendingAnEMailToMember");
$tmp .= '<br>('.$langs->trans("MailFrom").': <b>'.$conf->global->ADHERENT_MAIL_FROM.'</b>, ';
$tmp .= '<br>('.$langs->trans("MailFrom").': <b>'.getDolGlobalString('ADHERENT_MAIL_FROM').'</b>, ';
$tmp .= $langs->trans("MailRecipient").': <b>'.$object->email.'</b>)';
$helpcontent = '';
$helpcontent .= '<b>'.$langs->trans("MailFrom").'</b>: '.$conf->global->ADHERENT_MAIL_FROM.'<br>'."\n";
$helpcontent .= '<b>'.$langs->trans("MailFrom").'</b>: '.getDolGlobalString('ADHERENT_MAIL_FROM').'<br>'."\n";
$helpcontent .= '<b>'.$langs->trans("MailRecipient").'</b>: '.$object->email.'<br>'."\n";
$helpcontent .= '<b>'.$langs->trans("Subject").'</b>:<br>'."\n";
$helpcontent .= $subjecttosend."\n";

View File

@ -92,6 +92,7 @@ class Adherent extends CommonObject
/**
* @var string company name
* @deprecated
* @see $company
*/
public $societe;
@ -102,8 +103,14 @@ class Adherent extends CommonObject
/**
* @var int Thirdparty ID
* @deprecated
* @see $socid
*/
public $fk_soc;
/**
* @var int socid
*/
public $socid;
/**
@ -154,24 +161,28 @@ class Adherent extends CommonObject
/**
* @var string skype account
* @deprecated
* @see $socialnetworks
*/
public $skype;
/**
* @var string twitter account
* @deprecated
* @see $socialnetworks
*/
public $twitter;
/**
* @var string facebook account
* @deprecated
* @see $socialnetworks
*/
public $facebook;
/**
* @var string linkedin account
* @deprecated
* @see $socialnetworks
*/
public $linkedin;
@ -259,10 +270,19 @@ class Adherent extends CommonObject
*/
public $type;
/**
* @var int need_subscription
*/
public $need_subscription;
/**
* @var int user_id
*/
public $user_id;
/**
* @var string user_login
*/
public $user_login;
public $datefin;
@ -425,8 +445,8 @@ class Adherent extends CommonObject
// Envoi mail confirmation
$from = $conf->email_from;
if (!empty($conf->global->ADHERENT_MAIL_FROM)) {
$from = $conf->global->ADHERENT_MAIL_FROM;
if (!empty(getDolGlobalString('ADHERENT_MAIL_FROM'))) {
$from = getDolGlobalString('ADHERENT_MAIL_FROM');
}
$trackid = 'mem'.$this->id;
@ -576,7 +596,7 @@ class Adherent extends CommonObject
*/
public function create($user, $notrigger = 0)
{
global $conf, $langs;
global $conf, $langs, $mysoc;
$error = 0;
@ -624,7 +644,22 @@ class Adherent extends CommonObject
$id = $this->db->last_insert_id(MAIN_DB_PREFIX."adherent");
if ($id > 0) {
$this->id = $id;
$this->ref = (string) $id;
if (getDolGlobalString('MEMBER_CODEMEMBER_ADDON') == '') {
// keep old numbering
$this->ref = (string) $id;
} else {
// auto code
$modfile = dol_buildpath('core/modules/member/'.getDolGlobalString('MEMBER_CODEMEMBER_ADDON').'.php', 0);
try {
require_once $modfile;
$modname = getDolGlobalString('MEMBER_CODEMEMBER_ADDON');
$modCodeMember = new $modname;
$this->ref = $modCodeMember->getNextValue($mysoc, $this);
} catch (Exception $e) {
dol_syslog($e->getMessage(), LOG_ERR);
$error++;
}
}
// Update minor fields
$result = $this->update($user, 1, 1, 0, 0, 'add'); // nosync is 1 to avoid update data of user
@ -1505,7 +1540,7 @@ class Adherent extends CommonObject
require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
$sql = "SELECT c.rowid, c.fk_adherent, c.fk_type, c.subscription, c.note, c.fk_bank,";
$sql = "SELECT c.rowid, c.fk_adherent, c.fk_type, c.subscription, c.note as note_public, c.fk_bank,";
$sql .= " c.tms as datem,";
$sql .= " c.datec as datec,";
$sql .= " c.dateadh as dateh,";
@ -1537,7 +1572,8 @@ class Adherent extends CommonObject
$subscription->fk_adherent = $obj->fk_adherent;
$subscription->fk_type = $obj->fk_type;
$subscription->amount = $obj->subscription;
$subscription->note = $obj->note;
$subscription->note = $obj->note_public;
$subscription->note_public = $obj->note_public;
$subscription->fk_bank = $obj->fk_bank;
$subscription->datem = $this->db->jdate($obj->datem);
$subscription->datec = $this->db->jdate($obj->datec);
@ -3015,7 +3051,7 @@ class Adherent extends CommonObject
$subject = make_substitutions($arraydefaultmessage->topic, $substitutionarray, $outputlangs);
$msg = make_substitutions($arraydefaultmessage->content, $substitutionarray, $outputlangs);
$from = $conf->global->ADHERENT_MAIL_FROM;
$from = getDolGlobalString('ADHERENT_MAIL_FROM');
$to = $adherent->email;
$trackid = 'mem'.$adherent->id;

View File

@ -319,7 +319,7 @@ class AdherentType extends CommonObject
$sql .= ") VALUES (";
$sql .= "'".$this->db->escape($this->morphy)."'";
$sql .= ", '".$this->db->escape($this->label)."'";
$sql .= ", ".$conf->entity;
$sql .= ", ".((int) $conf->entity);
$sql .= ")";
dol_syslog("Adherent_type::create", LOG_DEBUG);

View File

@ -62,7 +62,7 @@ class Members extends DolibarrApi
*/
public function get($id)
{
if (!DolibarrApiAccess::$user->rights->adherent->lire) {
if (!DolibarrApiAccess::$user->hasRight('adherent', 'lire')) {
throw new RestException(401);
}
@ -99,7 +99,7 @@ class Members extends DolibarrApi
*/
public function getByThirdparty($thirdparty)
{
if (!DolibarrApiAccess::$user->rights->adherent->lire) {
if (!DolibarrApiAccess::$user->hasRight('adherent', 'lire')) {
throw new RestException(401);
}
@ -132,7 +132,7 @@ class Members extends DolibarrApi
*/
public function getByThirdpartyEmail($email)
{
if (!DolibarrApiAccess::$user->rights->adherent->lire) {
if (!DolibarrApiAccess::$user->hasRight('adherent', 'lire')) {
throw new RestException(401);
}
@ -171,7 +171,7 @@ class Members extends DolibarrApi
*/
public function getByThirdpartyBarcode($barcode)
{
if (!DolibarrApiAccess::$user->rights->adherent->lire) {
if (!DolibarrApiAccess::$user->hasRight('adherent', 'lire')) {
throw new RestException(401);
}
@ -217,7 +217,7 @@ class Members extends DolibarrApi
$obj_ret = array();
if (!DolibarrApiAccess::$user->rights->adherent->lire) {
if (!DolibarrApiAccess::$user->hasRight('adherent', 'lire')) {
throw new RestException(401);
}
@ -370,7 +370,7 @@ class Members extends DolibarrApi
*/
public function delete($id)
{
if (!DolibarrApiAccess::$user->rights->adherent->supprimer) {
if (!DolibarrApiAccess::$user->hasRight('adherent', 'supprimer')) {
throw new RestException(401);
}
$member = new Adherent($this->db);
@ -464,7 +464,7 @@ class Members extends DolibarrApi
{
$obj_ret = array();
if (!DolibarrApiAccess::$user->rights->adherent->cotisation->lire) {
if (!DolibarrApiAccess::$user->hasRight('adherent', 'cotisation', 'lire')) {
throw new RestException(401);
}
@ -495,7 +495,7 @@ class Members extends DolibarrApi
*/
public function createSubscription($id, $start_date, $end_date, $amount, $label = '')
{
if (!DolibarrApiAccess::$user->rights->adherent->cotisation->creer) {
if (!DolibarrApiAccess::$user->hasRight('adherent', 'cotisation', 'creer')) {
throw new RestException(401);
}

View File

@ -55,7 +55,7 @@ class MembersTypes extends DolibarrApi
*/
public function get($id)
{
if (!DolibarrApiAccess::$user->rights->adherent->lire) {
if (!DolibarrApiAccess::$user->hasRight('adherent', 'lire')) {
throw new RestException(401);
}
@ -92,7 +92,7 @@ class MembersTypes extends DolibarrApi
$obj_ret = array();
if (!DolibarrApiAccess::$user->rights->adherent->lire) {
if (!DolibarrApiAccess::$user->hasRight('adherent', 'lire')) {
throw new RestException(401);
}
@ -151,7 +151,7 @@ class MembersTypes extends DolibarrApi
*/
public function post($request_data = null)
{
if (!DolibarrApiAccess::$user->rights->adherent->configurer) {
if (!DolibarrApiAccess::$user->hasRight('adherent', 'configurer')) {
throw new RestException(401);
}
// Check mandatory fields
@ -176,7 +176,7 @@ class MembersTypes extends DolibarrApi
*/
public function put($id, $request_data = null)
{
if (!DolibarrApiAccess::$user->rights->adherent->configurer) {
if (!DolibarrApiAccess::$user->hasRight('adherent', 'configurer')) {
throw new RestException(401);
}
@ -216,7 +216,7 @@ class MembersTypes extends DolibarrApi
*/
public function delete($id)
{
if (!DolibarrApiAccess::$user->rights->adherent->configurer) {
if (!DolibarrApiAccess::$user->hasRight('adherent', 'configurer')) {
throw new RestException(401);
}
$membertype = new AdherentType($this->db);

View File

@ -58,7 +58,7 @@ class Subscriptions extends DolibarrApi
*/
public function get($id)
{
if (!DolibarrApiAccess::$user->rights->adherent->cotisation->lire) {
if (!DolibarrApiAccess::$user->hasRight('adherent', 'cotisation', 'lire')) {
throw new RestException(401);
}
@ -91,7 +91,7 @@ class Subscriptions extends DolibarrApi
$obj_ret = array();
if (!DolibarrApiAccess::$user->rights->adherent->cotisation->lire) {
if (!DolibarrApiAccess::$user->hasRight('adherent', 'cotisation', 'lire')) {
throw new RestException(401);
}
@ -148,7 +148,7 @@ class Subscriptions extends DolibarrApi
*/
public function post($request_data = null)
{
if (!DolibarrApiAccess::$user->rights->adherent->cotisation->creer) {
if (!DolibarrApiAccess::$user->hasRight('adherent', 'cotisation', 'creer')) {
throw new RestException(401);
}
// Check mandatory fields
@ -206,7 +206,7 @@ class Subscriptions extends DolibarrApi
public function delete($id)
{
// The right to delete a subscription comes with the right to create one.
if (!DolibarrApiAccess::$user->rights->adherent->cotisation->creer) {
if (!DolibarrApiAccess::$user->hasRight('adherent', 'cotisation', 'creer')) {
throw new RestException(401);
}
$subscription = new Subscription($this->db);

View File

@ -37,7 +37,7 @@ $sortorder = GETPOST('sortorder', 'aZ09');
if (!isModEnabled('adherent')) {
accessforbidden();
}
if (empty($user->rights->adherent->export)) {
if (!$user->hasRight('adherent', 'export')) {
accessforbidden();
}

View File

@ -51,14 +51,14 @@ if ($id > 0 || !empty($ref)) {
$result = $object->fetch($id, $ref);
// Define variables to know what current user can do on users
$canadduser = (!empty($user->admin) || !empty($user->rights->user->user->creer));
$canadduser = (!empty($user->admin) || $user->hasRight('user', 'user', 'creer'));
// Define variables to know what current user can do on properties of user linked to edited member
if ($object->user_id) {
// $User is the user who edits, $object->user_id is the id of the related user in the edited member
$caneditfielduser = ((($user->id == $object->user_id) && !empty($user->rights->user->self->creer))
|| (($user->id != $object->user_id) && !empty($user->rights->user->user->creer)));
|| (($user->id != $object->user_id) && $user->hasRight('user', 'user', 'creer')));
$caneditpassworduser = ((($user->id == $object->user_id) && $user->rights->user->self->password)
|| (($user->id != $object->user_id) && !empty($user->rights->user->user->password)));
|| (($user->id != $object->user_id) && $user->hasRight('user', 'user', 'password')));
}
}

View File

@ -262,7 +262,7 @@ if (empty($reshook)) {
}
// Create external user
if ($massaction == 'createexternaluser' && $user->hasRight('adherent', 'creer') && $user->rights->user->user->creer) {
if ($massaction == 'createexternaluser' && $user->hasRight('adherent', 'creer') && $user->hasRight('user', 'user', 'creer')) {
$tmpmember = new Adherent($db);
$error = 0;
$nbcreated = 0;

View File

@ -76,13 +76,13 @@ foreach ($object->fields as $key => $val) {
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
$permissiontoread = $user->rights->partnership->read;
$permissiontoadd = $user->rights->partnership->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
$permissiontodelete = $user->rights->partnership->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
$permissionnote = $user->rights->partnership->write; // Used by the include of actions_setnotes.inc.php
$permissiondellink = $user->rights->partnership->write; // Used by the include of actions_dellink.inc.php
$usercanclose = $user->rights->partnership->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
$upload_dir = $conf->partnership->multidir_output[isset($object->entity) ? $object->entity : 1];
$permissiontoread = $user->hasRight('partnership', 'read');
$permissiontoadd = $user->hasRight('partnership', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
$permissiontodelete = $user->hasRight('partnership', 'delete') || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
$permissionnote = $user->hasRight('partnership', 'write'); // Used by the include of actions_setnotes.inc.php
$permissiondellink = $user->hasRight('partnership', 'write'); // Used by the include of actions_dellink.inc.php
$usercanclose = $user->hasRight('partnership', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
$upload_dir = $conf->partnership->multidir_output[isset($object->entity) ? $object->entity : 1];
if (getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR') != 'member') {

View File

@ -101,14 +101,14 @@ if ($id > 0 || !empty($ref)) {
$result = $object->fetch($id, $ref);
// Define variables to know what current user can do on users
$canadduser = ($user->admin || $user->rights->user->user->creer);
$canadduser = ($user->admin || $user->hasRight("user", "user", "creer"));
// Define variables to know what current user can do on properties of user linked to edited member
if ($object->user_id) {
// $User is the user who edits, $object->user_id is the id of the related user in the edited member
$caneditfielduser = ((($user->id == $object->user_id) && $user->rights->user->self->creer)
|| (($user->id != $object->user_id) && $user->rights->user->user->creer));
$caneditpassworduser = ((($user->id == $object->user_id) && $user->rights->user->self->password)
|| (($user->id != $object->user_id) && $user->rights->user->user->password));
$caneditfielduser = ((($user->id == $object->user_id) && $user->hasRight("user", "self", "creer"))
|| (($user->id != $object->user_id) && $user->hasRight("user", "user", "creer")));
$caneditpassworduser = ((($user->id == $object->user_id) && $user->hasRight("user", "self", "password"))
|| (($user->id != $object->user_id) && $user->hasRight("user", "user", "password")));
}
}
@ -151,9 +151,9 @@ if (empty($reshook) && $action == 'confirm_create_thirdparty' && $confirm == 'ye
}
}
if (empty($reshook) && $action == 'setuserid' && ($user->rights->user->self->creer || $user->rights->user->user->creer)) {
if (empty($reshook) && $action == 'setuserid' && ($user->rights->user->self->creer || $user->hasRight('user', 'user', 'creer'))) {
$error = 0;
if (empty($user->rights->user->user->creer)) { // If can edit only itself user, we can link to itself only
if (!$user->hasRight('user', 'user', 'creer')) { // If can edit only itself user, we can link to itself only
if (GETPOST("userid", 'int') != $user->id && GETPOST("userid", 'int') != $object->user_id) {
$error++;
setEventMessages($langs->trans("ErrorUserPermissionAllowsToLinksToItselfOnly"), null, 'errors');
@ -201,7 +201,7 @@ if (empty($reshook) && $action == 'setsocid') {
}
}
if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !$cancel) {
if ($user->hasRight('adherent', 'cotisation', 'creer') && $action == 'subscription' && !$cancel) {
$error = 0;
$langs->load("banks");
@ -641,7 +641,7 @@ if ($rowid > 0) {
print '</td>';
if ($action != 'editlogin' && $user->hasRight('adherent', 'creer')) {
print '<td class="right">';
if ($user->rights->user->user->creer) {
if ($user->hasRight("user", "user", "creer")) {
print '<a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editlogin&token='.newToken().'&rowid='.$object->id.'">'.img_edit($langs->trans('SetLinkToUser'), 1).'</a>';
}
print '</td>';
@ -674,7 +674,7 @@ if ($rowid > 0) {
*/
// Button to create a new subscription if member no draft (-1) neither resiliated (0) neither excluded (-2)
if ($user->rights->adherent->cotisation->creer) {
if ($user->hasRight('adherent', 'cotisation', 'creer')) {
if ($action != 'addsubscription' && $action != 'create_thirdparty') {
print '<div class="tabsAction">';
@ -814,7 +814,7 @@ if ($rowid > 0) {
/*
* Add new subscription form
*/
if (($action == 'addsubscription' || $action == 'create_thirdparty') && $user->rights->adherent->cotisation->creer) {
if (($action == 'addsubscription' || $action == 'create_thirdparty') && $user->hasRight('adherent', 'cotisation', 'creer')) {
print '<br>';
print load_fiche_titre($langs->trans("NewCotisation"));
@ -1142,7 +1142,7 @@ if ($rowid > 0) {
$tmp = '<input name="sendmail" type="checkbox"'.(GETPOST('sendmail', 'alpha') ? ' checked' : (!empty($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL) ? ' checked' : '')).'>';
$helpcontent = '';
$helpcontent .= '<b>'.$langs->trans("MailFrom").'</b>: '.$conf->global->ADHERENT_MAIL_FROM.'<br>'."\n";
$helpcontent .= '<b>'.$langs->trans("MailFrom").'</b>: '.getDolGlobalString('ADHERENT_MAIL_FROM').'<br>'."\n";
$helpcontent .= '<b>'.$langs->trans("MailRecipient").'</b>: '.$object->email.'<br>'."\n";
$helpcontent .= '<b>'.$langs->trans("MailTopic").'</b>:<br>'."\n";
if ($subjecttosend) {

View File

@ -49,13 +49,13 @@ $note = GETPOST('note', 'alpha');
$typeid = (int) GETPOST('typeid', 'int');
$amount = price2num(GETPOST('amount', 'alpha'), 'MT');
if (empty($user->rights->adherent->cotisation->lire)) {
if (!$user->hasRight('adherent', 'cotisation', 'lire')) {
accessforbidden();
}
$permissionnote = $user->rights->adherent->cotisation->creer; // Used by the include of actions_setnotes.inc.php
$permissiondellink = $user->rights->adherent->cotisation->creer; // Used by the include of actions_dellink.inc.php
$permissiontoedit = $user->rights->adherent->cotisation->creer; // Used by the include of actions_lineupdonw.inc.php
$permissionnote = $user->hasRight('adherent', 'cotisation', 'creer'); // Used by the include of actions_setnotes.inc.php
$permissiondellink = $user->hasRight('adherent', 'cotisation', 'creer'); // Used by the include of actions_dellink.inc.php
$permissiontoedit = $user->hasRight('adherent', 'cotisation', 'creer'); // Used by the include of actions_lineupdonw.inc.php
$hookmanager->initHooks(array('subscriptioncard', 'globalcard'));
@ -78,7 +78,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, n
//include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; // Must be include, not include_once
if ($user->rights->adherent->cotisation->creer && $action == 'update' && !$cancel) {
if ($user->hasRight('adherent', 'cotisation', 'creer') && $action == 'update' && !$cancel) {
// Load current object
$result = $object->fetch($rowid);
if ($result > 0) {
@ -140,7 +140,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'update' && !$cance
}
}
if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->adherent->cotisation->creer) {
if ($action == 'confirm_delete' && $confirm == 'yes' && $user->hasRight('adherent', 'cotisation', 'creer')) {
$result = $object->fetch($rowid);
$result = $object->delete($user);
if ($result > 0) {
@ -166,7 +166,7 @@ llxHeader('', $langs->trans("SubscriptionCard"), $help_url);
dol_htmloutput_errors($errmsg);
if ($user->rights->adherent->cotisation->creer && $action == 'edit') {
if ($user->hasRight('adherent', 'cotisation', 'creer') && $action == 'edit') {
/********************************************
*
* Subscription card in edit mode
@ -350,7 +350,7 @@ if ($rowid && $action != 'edit') {
*/
print '<div class="tabsAction">';
if ($user->rights->adherent->cotisation->creer) {
if ($user->hasRight('adherent', 'cotisation', 'creer')) {
if (!empty($bankline->rappro)) {
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"]."?rowid=".$object->id.'&action=edit&token='.newToken().'">'.$langs->trans("Modify")."</a></div>";
} else {
@ -359,7 +359,7 @@ if ($rowid && $action != 'edit') {
}
// Delete
if ($user->rights->adherent->cotisation->creer) {
if ($user->hasRight('adherent', 'cotisation', 'creer')) {
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"]."?rowid=".$object->id.'&action=delete&token='.newToken().'">'.$langs->trans("Delete")."</a></div>\n";
}

View File

@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
// Load translation files required by the page
$langs->loadLangs(array("companies", "members", "bills", "users"));
if (empty($user->rights->adherent->lire)) {
if (!$user->hasRight('adherent', 'lire')) {
accessforbidden();
}

View File

@ -291,14 +291,14 @@ $arrayofmassactions = array(
//'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
//'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
);
//if ($user->rights->adherent->supprimer) $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
//if ($user->hasRight('adherent', 'supprimer')) $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
if (in_array($massaction, array('presend', 'predelete'))) {
$arrayofmassactions = array();
}
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
$newcardbutton = '';
if ($user->rights->adherent->cotisation->creer) {
if ($user->hasRight('adherent', 'cotisation', 'creer')) {
$newcardbutton .= dolGetButtonTitle($langs->trans('NewSubscription'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/list.php?status=-1,1');
}

View File

@ -39,7 +39,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) {
echo '<td class="center"></td>';
echo '<td class="center">'.dol_print_date($objectlink->dateh, 'day').'</td>';
echo '<td class="right">';
if ($user->rights->adherent->lire) {
if ($user->hasRight('adherent', 'lire')) {
$total = $total + $objectlink->amount;
echo price($objectlink->amount);
}

View File

@ -81,6 +81,7 @@ $duration_unit = GETPOST('duration_unit', 'alpha');
$vote = GETPOST("vote", "int");
$comment = GETPOST("comment", 'restricthtml');
$mail_valid = GETPOST("mail_valid", 'restricthtml');
$caneditamount = GETPOSTINT("caneditamount");
// Security check
$result = restrictedArea($user, 'adherent', $rowid, 'adherent_type');
@ -124,11 +125,11 @@ if ($action == 'add' && $user->hasRight('adherent', 'configurer')) {
$object->status = (int) $status;
$object->subscription = (int) $subscription;
$object->amount = ($amount == '' ? '' : price2num($amount, 'MT'));
$object->caneditamount = GETPOSTINT("caneditamount");
$object->caneditamount = $caneditamount;
$object->duration_value = $duration_value;
$object->duration_unit = $duration_unit;
$object->note = trim($comment);
$object->note_public = trim($comment);
$object->note_private = '';
$object->mail_valid = trim($mail_valid);
$object->vote = (int) $vote;
@ -142,7 +143,7 @@ if ($action == 'add' && $user->hasRight('adherent', 'configurer')) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Label")), null, 'errors');
} else {
$sql = "SELECT libelle FROM ".MAIN_DB_PREFIX."adherent_type WHERE libelle='".$db->escape($object->label)."'";
$sql = "SELECT libelle FROM ".MAIN_DB_PREFIX."adherent_type WHERE libelle = '".$db->escape($object->label)."'";
$sql .= " WHERE entity IN (".getEntity('member_type').")";
$result = $db->query($sql);
$num = null;
@ -170,7 +171,7 @@ if ($action == 'add' && $user->hasRight('adherent', 'configurer')) {
}
}
if ($action == 'update' && $user->rights->adherent->configurer) {
if ($action == 'update' && $user->hasRight('adherent', 'configurer')) {
$object->fetch($rowid);
$object->oldcopy = dol_clone($object);
@ -183,8 +184,8 @@ if ($action == 'update' && $user->rights->adherent->configurer) {
$object->caneditamount = $caneditamount;
$object->duration_value = $duration_value;
$object->duration_unit = $duration_unit;
$object->note = trim($comment);
$object->note_public = trim($comment);
$object->note_private = '';
$object->mail_valid = trim($mail_valid);
$object->vote = (boolean) trim($vote);
@ -206,7 +207,7 @@ if ($action == 'update' && $user->rights->adherent->configurer) {
exit;
}
if ($action == 'confirm_delete' && !empty($user->rights->adherent->configurer)) {
if ($action == 'confirm_delete' && $user->hasRight('adherent', 'configurer')) {
$object->fetch($rowid);
$res = $object->delete();
@ -256,7 +257,7 @@ if (!$rowid && $action != 'create' && $action != 'edit') {
}
$newcardbutton = '';
if ($user->rights->adherent->configurer) {
if ($user->hasRight('adherent', 'configurer')) {
$newcardbutton .= dolGetButtonTitle($langs->trans('NewMemberType'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/type.php?action=create');
}
@ -322,7 +323,7 @@ if (!$rowid && $action != 'create' && $action != 'edit') {
print '<td class="center">'.yn($objp->caneditamount).'</td>';
print '<td class="center">'.yn($objp->vote).'</td>';
print '<td class="center">'.$membertype->getLibStatut(5).'</td>';
if ($user->rights->adherent->configurer) {
if ($user->hasRight('adherent', 'configurer')) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=edit&rowid='.$objp->rowid.'">'.img_edit().'</a></td>';
} else {
print '<td class="right">&nbsp;</td>';
@ -390,8 +391,8 @@ if ($action == 'create') {
print '<input name="amount" size="5" value="'.(GETPOSTISSET('amount') ? GETPOST('amount') : price($amount)).'">';
print '</td></tr>';
print '<tr><td>'.$langs->trans("CanEditAmount").'</td><td>';
print $form->selectyesno("caneditamount", 0, 1);
print '<tr><td>'.$form->textwithpicto($langs->trans("CanEditAmountShort"), $langs->transnoentities("CanEditAmount")).'</td><td>';
print $form->selectyesno("caneditamount", GETPOSTISSET('caneditamount') ? GETPOST('caneditamount') : 0, 1);
print '</td></tr>';
print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
@ -832,7 +833,7 @@ if ($rowid > 0) {
print '</td></tr>';
print '<tr><td>'.$form->textwithpicto($langs->trans("CanEditAmountShort"), $langs->transnoentities("CanEditAmountDetail")).'</td><td>';
print $form->selectyesno("caneditamount", $object->caneditamount);
print $form->selectyesno("caneditamount", $object->caneditamount, 1);
print '</td></tr>';
print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';

View File

@ -71,7 +71,7 @@ if ($action == 'delete' && GETPOST('langtodelete', 'alpha')) {
}
// Add translation
if ($action == 'vadd' && $cancel != $langs->trans("Cancel") && $user->rights->adherent->configurer) {
if ($action == 'vadd' && $cancel != $langs->trans("Cancel") && $user->hasRight('adherent', 'configurer')) {
$object = new AdherentType($db);
$object->fetch($id);
$current_lang = $langs->getDefaultLang();
@ -99,7 +99,7 @@ if ($action == 'vadd' && $cancel != $langs->trans("Cancel") && $user->rights->ad
}
// Edit translation
if ($action == 'vedit' && $cancel != $langs->trans("Cancel") && $user->rights->adherent->configurer) {
if ($action == 'vedit' && $cancel != $langs->trans("Cancel") && $user->hasRight('adherent', 'configurer')) {
$object = new AdherentType($db);
$object->fetch($id);
$current_lang = $langs->getDefaultLang();
@ -125,7 +125,7 @@ if ($action == 'vedit' && $cancel != $langs->trans("Cancel") && $user->rights->a
}
// Delete translation
if ($action == 'vdelete' && $cancel != $langs->trans("Cancel") && $user->rights->adherent->configurer) {
if ($action == 'vdelete' && $cancel != $langs->trans("Cancel") && $user->hasRight('adherent', 'configurer')) {
$object = new AdherentType($db);
$object->fetch($id);
$langtodelete = GETPOST('langdel', 'alpha');

View File

@ -42,14 +42,14 @@ if ($id > 0 || !empty($ref)) {
$result = $object->fetch($id, $ref);
// Define variables to know what current user can do on users
$canadduser = ($user->admin || $user->rights->user->user->creer);
$canadduser = ($user->admin || $user->hasRight('user', 'user', 'creer'));
// Define variables to know what current user can do on properties of user linked to edited member
if ($object->user_id) {
// $User is the user who edits, $object->user_id is the id of the related user in the edited member
$caneditfielduser = ((($user->id == $object->user_id) && $user->rights->user->self->creer)
|| (($user->id != $object->user_id) && $user->rights->user->user->creer));
$caneditpassworduser = ((($user->id == $object->user_id) && $user->rights->user->self->password)
|| (($user->id != $object->user_id) && $user->rights->user->user->password));
$caneditfielduser = ((($user->id == $object->user_id) && $user->hasRight('user', 'self', 'creer'))
|| (($user->id != $object->user_id) && $user->hasRight('user', 'user', 'creer')));
$caneditpassworduser = ((($user->id == $object->user_id) && $user->hasRight('user', 'self', 'password'))
|| (($user->id != $object->user_id) && $user->hasRight('user', 'user', 'password')));
}
}

View File

@ -279,13 +279,13 @@ while ($i <= $MAXAGENDA) {
print '</td>';
// Calendar active by default
print '<td class="nowrap right">';
if ($conf->use_javascript_ajax) {
if (!empty($conf->use_javascript_ajax)) {
print ajax_constantonoff('AGENDA_EXT_ACTIVEBYDEFAULT' . $key);
} else {
if (empty($conf->global->{$default})) {
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=set_AGENDA_EXT_ACTIVEBYDEFAULT' . $key . '&token='.newToken().'">' . img_picto($langs->trans("Enabled"), 'on') . '</a>';
} else {
if (getDolGlobalString($default)) {
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=del_AGENDA_EXT_ACTIVEBYDEFAULT' . $key . '&token='.newToken().'">' . img_picto($langs->trans("Disabled"), 'off') . '</a>';
} else {
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=set_AGENDA_EXT_ACTIVEBYDEFAULT' . $key . '&token='.newToken().'">' . img_picto($langs->trans("Enabled"), 'on') . '</a>';
}
}
print '</td>';

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2022 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
*
@ -357,7 +357,7 @@ foreach ($boxtoadd as $box) {
// For each possible position, an activation link is displayed if the box is not already active for that position
print '<td class="center">';
print $form->selectarray("boxid[".$box->box_id."][pos]", $arrayofhomepages, -1, 1, 0, 0, '', 1)."\n";
print $form->selectarray("boxid[".$box->box_id."][pos]", $arrayofhomepages, -1, 1, 0, 0, '', 1, 0, 0, '', 'minwidth75', 1)."\n";
print '<input type="hidden" name="boxid['.$box->box_id.'][value]" value="'.$box->box_id.'">'."\n";
print '</td>';

View File

@ -518,7 +518,7 @@ print '</tr>';
print '<tr class="oddeven">';
print '<td>'.$langs->trans("AllowOnlineSign").'</td>';
print '<td class="center">';
if ($conf->global->CONTRACT_ALLOW_ONLINESIGN) {
if (getDolGlobalString('CONTRACT_ALLOW_ONLINESIGN')) {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=allowonlinesign&token='.newToken().'&value=0">';
print img_picto($langs->trans("Activited"), 'switch_on');
print '</a>';

View File

@ -83,9 +83,7 @@ if ($cancel) {
$action ='';
}
if ((float) DOL_VERSION >= 6) {
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
}
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
if ($action == 'updateMask') {
$maskconstorder = GETPOST('maskconstorder', 'alpha');

View File

@ -110,11 +110,11 @@ print dol_get_fiche_head($head, 'audit', '', -1);
print '<br>';
print '<table class="noborder" width="100%">';
print "<tr class=\"liste_titre\">";
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print getTitleFieldOfList("TrackableSecurityEvents", 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, '')."\n";
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
print "</tr>\n";
print '</tr>'."\n";
// Loop on each event type
foreach ($eventstolog as $key => $arr) {
if ($arr['id']) {
@ -129,12 +129,12 @@ foreach ($eventstolog as $key => $arr) {
}
print '</table>';
print dol_get_fiche_end();
print '<div class="center">';
print '<input type="submit" name="save" class="button button-save" value="'.$langs->trans("Save").'">';
print '</div>';
print dol_get_fiche_end();
print "</form>\n";
// End of page

View File

@ -743,7 +743,7 @@ print load_fiche_titre($langs->trans("OtherOptions"), '', '');
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameter").'</td>';
print '<td>'.$langs->trans("Parameters").'</td>';
print '<td class="center" width="60">'.$langs->trans("Value").'</td>';
print '<td width="80">&nbsp;</td>';
print "</tr>\n";

View File

@ -70,9 +70,7 @@ $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
* Actions
*/
if ((float) DOL_VERSION >= 6) {
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
}
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
if ($action == 'update') {
$max_rank = GETPOST('HRM_MAXRANK', 'int');

View File

@ -51,8 +51,19 @@ if ($action == 'setvalue') {
$mailerror = GETPOST('MAILING_EMAIL_ERRORSTO', 'alpha');
$checkread = GETPOST('value', 'alpha');
$checkread_key = GETPOST('MAILING_EMAIL_UNSUBSCRIBE_KEY', 'alpha');
$mailingdelay = GETPOST('MAILING_DELAY', 'int');
$contactbulkdefault = GETPOST('MAILING_CONTACT_DEFAULT_BULK_STATUS', 'int');
if (GETPOST('MAILING_DELAY', 'alpha') != '') {
$mailingdelay = price2num(GETPOST('MAILING_DELAY', 'alpha'), 3); // Not less than 1 millisecond.
} else {
$mailingdelay = '';
}
// Clean data
if ((float) $mailingdelay > 10) {
$mailingdelay = 10;
}
if (GETPOST('MAILING_DELAY', 'alpha') != '' && GETPOST('MAILING_DELAY', 'alpha') != '0' && (float) $mailingdelay < 0.001) {
$mailingdelay = 0.001;
}
$res = dolibarr_set_const($db, "MAILING_EMAIL_FROM", $mailfrom, 'chaine', 0, '', $conf->entity);
if (!($res > 0)) {
@ -148,7 +159,7 @@ print '<td class="hideonsmartphone"><span class="opacitymedium">webmaster@exampl
print '</tr>';
print '<tr class="oddeven"><td>';
print $langs->trans("MailingDelay").'</td><td>';
print $form->textwithpicto($langs->trans("MailingDelay"), $langs->trans("IfDefinedUseAValueBeetween", '0.001', '10')).'</td><td>';
print '<input class="width75" type="text" name="MAILING_DELAY" value="'.$conf->global->MAILING_DELAY.'">';
print '</td>';
print '<td class="hideonsmartphone"></td>';

View File

@ -246,17 +246,17 @@ if ($reshook == 0) {
}
}
$id = 25;
$acceptlocallinktomedia = (acceptLocalLinktoMedia() > 0 ? 1 : 0);
// Security
if (!empty($user->socid)) {
accessforbidden();
}
$permissiontoadd = 1;
//asort($elementList);
$id = 25;
$permissiontodelete = 1;
@ -294,8 +294,8 @@ if (empty($reshook)) {
$search_array_options = array();
}
// Actions add or modify an entry into a dictionary
if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) {
// Actions add or modify an email template
if ((GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) && $permissiontoadd) {
$listfield = explode(',', str_replace(' ', '', $tabfield[$id]));
$listfieldinsert = explode(',', $tabfieldinsert[$id]);
$listfieldmodify = explode(',', $tabfieldinsert[$id]);
@ -512,7 +512,7 @@ if (empty($reshook)) {
}
}
if ($action == 'confirm_delete' && $confirm == 'yes') { // delete
if ($action == 'confirm_delete' && $confirm == 'yes' && $permissiontodelete) { // delete
$rowidcol = "rowid";
$sql = "DELETE from ".$tabname[$id]." WHERE ".$rowidcol." = ".((int) $rowid);
@ -531,7 +531,7 @@ if (empty($reshook)) {
}
// activate
if ($action == $acts[0]) {
if ($action == $acts[0] && $permissiontoadd) {
$rowidcol = "rowid";
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE rowid = ".((int) $rowid);
@ -543,7 +543,7 @@ if (empty($reshook)) {
}
// disable
if ($action == $acts[1]) {
if ($action == $acts[1] && $permissiontoadd) {
$rowidcol = "rowid";
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE rowid = ".((int) $rowid);
@ -828,7 +828,8 @@ if ($action == 'create') {
if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) {
$okforextended = false;
}
$doleditor = new DolEditor($tmpfieldlist, (!empty($obj->$tmpfieldlist) ? $obj->$tmpfieldlist : ''), '', 180, 'dolibarr_mailings', 'In', 0, true, $okforextended, ROWS_4, '90%');
$doleditor = new DolEditor($tmpfieldlist, (!empty($obj->$tmpfieldlist) ? $obj->$tmpfieldlist : ''), '', 180, 'dolibarr_mailings', 'In', false, $acceptlocallinktomedia, $okforextended, ROWS_4, '90%');
print $doleditor->Create(1);
}
print '</td>';
@ -912,17 +913,17 @@ foreach ($fieldlist as $field => $value) {
print '<td class="liste_titre"><input type="text" name="search_label" class="maxwidth200" value="'.dol_escape_htmltag($search_label).'"></td>';
} elseif ($value == 'lang') {
print '<td class="liste_titre">';
print $formadmin->select_language($search_lang, 'search_lang', 0, null, 1, 0, 0, 'maxwidth150');
print $formadmin->select_language($search_lang, 'search_lang', 0, null, 1, 0, 0, 'maxwidth100');
print '</td>';
} elseif ($value == 'fk_user') {
print '<td class="liste_titre">';
print $form->select_dolusers($search_fk_user, 'search_fk_user', 1, null, 0, ($user->admin ? '' : 'hierarchyme'), null, 0, 0, 0, '', 0, '', 'maxwidth150', 1);
print $form->select_dolusers($search_fk_user, 'search_fk_user', 1, null, 0, ($user->admin ? '' : 'hierarchyme'), null, 0, 0, 0, '', 0, '', 'maxwidth125', 1);
print '</td>';
} elseif ($value == 'topic') {
print '<td class="liste_titre"><input type="text" name="search_topic" value="'.dol_escape_htmltag($search_topic).'"></td>';
} elseif ($value == 'type_template') {
print '<td class="liste_titre center">';
print $form->selectarray('search_type_template', $elementList, $search_type_template, 1, 0, 0, '', 0, 0, 0, '', 'minwidth150', 1, '', 0, 1);
print $form->selectarray('search_type_template', $elementList, $search_type_template, 1, 0, 0, '', 0, 0, 0, '', 'minwidth100 maxwidth125', 1, '', 0, 1);
print '</td>';
} elseif (!in_array($value, array('content', 'content_lines'))) {
print '<td class="liste_titre"></td>';
@ -1061,46 +1062,13 @@ if ($num) {
print $form->selectyesno($tmpfieldlist.'-'.$rowid, (isset($obj->$tmpfieldlist) ? $obj->$tmpfieldlist : '0'), 1, false, 0, 1);
}
// If $acceptlocallinktomedia is true, we can add link media files int email templates (we already can do this into HTML editor of an email).
// Note that local link to a file into medias are replaced with a real link by email in CMailFile.class.php with value $urlwithroot defined like this:
// $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
// $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
$acceptlocallinktomedia = getDolGlobalInt('MAIN_DISALLOW_MEDIAS_IN_EMAIL_TEMPLATES') ? 0 : 1;
if ($acceptlocallinktomedia) {
global $dolibarr_main_url_root;
$urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
// Parse $newUrl
$newUrlArray = parse_url($urlwithouturlroot);
$hosttocheck = $newUrlArray['host'];
$hosttocheck = str_replace(array('[', ']'), '', $hosttocheck); // Remove brackets of IPv6
if (function_exists('gethostbyname')) {
$iptocheck = gethostbyname($hosttocheck);
} else {
$iptocheck = $hosttocheck;
}
//var_dump($iptocheck.' '.$acceptlocallinktomedia);
if (!filter_var($iptocheck, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) {
// If ip of public url is an private network IP, we do not allow this.
$acceptlocallinktomedia = 0;
// TODO Show a warning
}
if (preg_match('/http:/i', $urlwithouturlroot)) {
// If public url is not a https, we do not allow to add medias link. It will generate security alerts when email will be sent.
$acceptlocallinktomedia = 0;
// TODO Show a warning
}
}
if ($tmpfieldlist == 'content') {
print $form->textwithpicto($langs->trans("Content"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'<br>';
$okforextended = true;
if (empty($conf->global->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%');
print $doleditor->Create(1);
}

View File

@ -35,7 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
// Load translation files required by the page
$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'stocks', 'Trips'));
$langs->loadLangs(array('admin', 'companies', 'languages', 'members', 'other', 'products', 'stocks', 'trips'));
if (!$user->admin) {
accessforbidden();
@ -276,7 +276,7 @@ print load_fiche_titre($langs->trans("DictionaryPaperFormat"), '', '');
print '<div class="div-table-responsive-no-min">';
print '<table summary="more" class="noborder centpercent">';
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameters").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
$selected = (isset($conf->global->MAIN_PDF_FORMAT) ? $conf->global->MAIN_PDF_FORMAT : '');
if (empty($selected)) {

View File

@ -5,6 +5,7 @@
* Copyright (C) 2012-2107 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2019 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2021-2022 Anthony Berton <bertonanthony@gmail.com>
* Copyright (C) 2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -35,7 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
// Load translation files required by the page
$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'stocks', 'Trips'));
$langs->loadLangs(array('admin', 'bills', 'companies', 'languages', 'members', 'other', 'products', 'propal', 'receptions', 'stocks', 'trips'));
if (!$user->admin) {
accessforbidden();
@ -69,6 +70,9 @@ if ($action == 'update') {
dolibarr_set_const($db, "INVOICE_ADD_SWISS_QR_CODE", GETPOST("INVOICE_ADD_SWISS_QR_CODE", 'int'), 'chaine', 0, '', $conf->entity);
dolibarr_del_const($db, "INVOICE_ADD_ZATCA_QR_CODE", $conf->entity);
}
if (GETPOSTISSET('INVOICE_CATEGORY_OF_OPERATION')) {
dolibarr_set_const($db, "INVOICE_CATEGORY_OF_OPERATION", GETPOST("INVOICE_CATEGORY_OF_OPERATION", 'int'), 'chaine', 0, '', $conf->entity);
}
if (GETPOSTISSET('INVOICE_SHOW_SHIPPING_ADDRESS')) {
dolibarr_set_const($db, "INVOICE_SHOW_SHIPPING_ADDRESS", GETPOST("INVOICE_SHOW_SHIPPING_ADDRESS", 'int'), 'chaine', 0, '', $conf->entity);
dolibarr_del_const($db, "INVOICE_SHOW_SHIPPING_ADDRESS", $conf->entity);
@ -135,7 +139,7 @@ if (isModEnabled('facture')) {
print '<div class="div-table-responsive-no-min">';
print '<table summary="more" class="noborder centpercent">';
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameters").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("INVOICE_ADD_ZATCA_QR_CODE"), $langs->trans("INVOICE_ADD_ZATCA_QR_CODEMore"));
@ -159,11 +163,21 @@ if (isModEnabled('facture')) {
}
print '</td></tr>';
// Mention category of operations
// French Decret n°2099-1299 2022-10-07
print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("INVOICE_SHOW_SHIPPING_ADDRESS"), $langs->trans("INVOICE_SHOW_SHIPPING_ADDRESSMore"));
print $form->textwithpicto($langs->trans("InvoiceOptionCategoryOfOperations"), $langs->trans('InvoiceOptionCategoryOfOperationsHelp'), 1);
print '</td><td>';
$arrval = array('0'=>$langs->trans("No"),
'1'=>$langs->trans("InvoiceOptionCategoryOfOperationsYes1"),
'2'=>$langs->trans("InvoiceOptionCategoryOfOperationsYes2")
);
print $form->selectarray("INVOICE_CATEGORY_OF_OPERATION", $arrval, $conf->global->INVOICE_CATEGORY_OF_OPERATION, 0, 0, 0, '', 0, 0, 0, '', 'minwidth75imp');
print '</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING").'</td><td>';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('INVOICE_SHOW_SHIPPING_ADDRESS');
print ajax_constantonoff('MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("INVOICE_SHOW_SHIPPING_ADDRESS", $arrval, $conf->global->INVOICE_SHOW_SHIPPING_ADDRESS);
@ -181,7 +195,7 @@ if (isModEnabled('reception')) {
print '<div class="div-table-responsive-no-min">';
print '<table summary="more" class="noborder centpercent">';
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameters").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
print '<tr class="oddeven"><td>';
print $langs->trans("RECEPTION_PDF_HIDE_ORDERED");

View File

@ -271,8 +271,8 @@ print '</div>';
print '</form>';
//if($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK == 1)
// Patter for Password Perso
// Pattern for Password Perso
if ($conf->global->USER_PASSWORD_GENERATED == "Perso") {
print '<br>';
@ -320,10 +320,10 @@ if ($conf->global->USER_PASSWORD_GENERATED == "Perso") {
print '</table>';
print '<br>';
print '<div class="center">';
print '<a class="button button-save" id="linkChangePattern">'.$langs->trans("Save").'</a>';
print '</div>';
print '<br><br>';
print '<script type="text/javascript">';
@ -392,7 +392,7 @@ print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td colspan="3">'.$langs->trans("Parameters").'</td>';
print '<td class="center">'.$langs->trans("Activated").'</td>';
print '<td class="center">'.$langs->trans("Action").'</td>';
print '<td class="center"></td>';
print '</tr>';
// Disable clear password in database

View File

@ -115,15 +115,15 @@ print '<br>';
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent nomarginbottom">';
print '<tr class="liste_titre">';
print '<td colspan="2">'.$langs->trans("Parameters").'</td>';
print '<td>'.$langs->trans("Parameters").'</td>';
print '<td>'.$langs->trans("Value").'</td>';
print '</tr>';
print '<tr class="oddeven">';
print '<td colspan="2">'.$langs->trans("MaxSizeForUploadedFiles").'.';
print '<td>'.$langs->trans("MaxSizeForUploadedFiles").'.';
$max = @ini_get('upload_max_filesize');
if (isset($max)) {
print ' '.$langs->trans("MustBeLowerThanPHPLimit", ((int) $max) * 1024, $langs->trans("Kb")).'.';
print '<br><span class="opacitymedium">'.$langs->trans("MustBeLowerThanPHPLimit", ((int) $max) * 1024, $langs->trans("Kb")).'.</span>';
} else {
print ' '.$langs->trans("NoMaxSizeByPHPLimit").'.';
}
@ -135,8 +135,8 @@ print '</tr>';
print '<tr class="oddeven">';
print '<td>'.$langs->trans("UMask").'</td><td class="right">';
print $form->textwithpicto('', $langs->trans("UMaskExplanation"));
print '<td>';
print $form->textwithpicto($langs->trans("UMask"), $langs->trans("UMaskExplanation"));
print '</td>';
print '<td class="nowrap">';
print '<input class="flat" name="MAIN_UMASK" type="text" size="6" value="'.dol_escape_htmltag($conf->global->MAIN_UMASK).'">';
@ -146,7 +146,7 @@ print '</tr>';
// Use anti virus
print '<tr class="oddeven">';
print '<td colspan="2">'.$langs->trans("AntiVirusCommand").'<br>';
print '<td>'.$langs->trans("AntiVirusCommand").'<br>';
print '<span class="opacitymedium">'.$langs->trans("AntiVirusCommandExample").'</span>';
// Check command in inside safe_mode
print '</td>';
@ -170,7 +170,7 @@ print '</tr>';
// Use anti virus
print '<tr class="oddeven">';
print '<td colspan="2">'.$langs->trans("AntiVirusParam").'<br>';
print '<td>'.$langs->trans("AntiVirusParam").'<br>';
print '<span class="opacitymedium">'.$langs->trans("AntiVirusParamExample").'</span>';
print '</td>';
print '<td>';
@ -198,7 +198,9 @@ $formfile->form_attach_new_file($_SERVER['PHP_SELF'], $langs->trans("FormToTestF
// List of document
$filearray = dol_dir_list($upload_dir, "files", 0, '', '', $sortfield, $sortorder == 'desc' ? SORT_DESC : SORT_ASC, 1);
$formfile->list_of_documents($filearray, null, 'admin_temp', '');
if (count($filearray) > 0) {
$formfile->list_of_documents($filearray, null, 'admin_temp', '');
}
// End of page
llxFooter();

View File

@ -211,7 +211,11 @@ print '<td>'.$langs->trans("DeStockOnBill").'</td>';
print '<td class="right">';
if (isModEnabled('facture')) {
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_CALCULATE_ON_BILL', array(), null, 0, 0, 0, 2, 1);
if ($disabled) {
print img_picto($langs->trans("Disabled"), 'off', 'class="opacitymedium"');
} else {
print ajax_constantonoff('STOCK_CALCULATE_ON_BILL', array(), null, 0, 0, 0, 2, 1, 0, '', '', 'reposition');
}
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_CALCULATE_ON_BILL", $arrval, $conf->global->STOCK_CALCULATE_ON_BILL);
@ -228,7 +232,11 @@ print '<td>'.$langs->trans("DeStockOnValidateOrder").'</td>';
print '<td class="right">';
if (isModEnabled('commande')) {
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_CALCULATE_ON_VALIDATE_ORDER', array(), null, 0, 0, 0, 2, 1);
if ($disabled) {
print img_picto($langs->trans("Disabled"), 'off', 'class="opacitymedium"');
} else {
print ajax_constantonoff('STOCK_CALCULATE_ON_VALIDATE_ORDER', array(), null, 0, 0, 0, 2, 1, '', '', 'reposition');
}
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_CALCULATE_ON_VALIDATE_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER);
@ -247,7 +255,7 @@ print '<td>'.$langs->trans("DeStockOnShipment").'</td>';
print '<td class="right">';
if (isModEnabled("expedition")) {
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_CALCULATE_ON_SHIPMENT', array(), null, 0, 0, 0, 2, 1);
print ajax_constantonoff('STOCK_CALCULATE_ON_SHIPMENT', array(), null, 0, 0, 0, 2, 1, '', '', 'reposition');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_CALCULATE_ON_SHIPMENT", $arrval, $conf->global->STOCK_CALCULATE_ON_SHIPMENT);
@ -264,7 +272,7 @@ print '<td>'.$langs->trans("DeStockOnShipmentOnClosing").'</td>';
print '<td class="right">';
if (isModEnabled("expedition")) {
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_CALCULATE_ON_SHIPMENT_CLOSE', array(), null, 0, 0, 0, 2, 1);
print ajax_constantonoff('STOCK_CALCULATE_ON_SHIPMENT_CLOSE', array(), null, 0, 0, 0, 2, 1, '', '', 'reposition');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_CALCULATE_ON_SHIPMENT_CLOSE", $arrval, $conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE);
@ -295,7 +303,11 @@ print '<td>'.$langs->trans("ReStockOnBill").'</td>';
print '<td class="right">';
if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) {
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_BILL', array(), null, 0, 0, 0, 2, 1);
if ($disabled) {
print img_picto($langs->trans("Disabled"), 'off', 'class="opacitymedium"');
} else {
print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_BILL', array(), null, 0, 0, 0, 2, 1, '', '', 'reposition');
}
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_BILL", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL);
@ -313,7 +325,11 @@ print '<td>'.$langs->trans("ReStockOnValidateOrder").'</td>';
print '<td class="right">';
if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) {
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER', array(), null, 0, 0, 0, 2, 1);
if ($disabled) {
print img_picto($langs->trans("Disabled"), 'off', 'class="opacitymedium"');
} else {
print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER', array(), null, 0, 0, 0, 2, 1, '', '', 'reposition');
}
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER);
@ -330,7 +346,7 @@ if (isModEnabled("reception")) {
print '<td class="right">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_CALCULATE_ON_RECEPTION', array(), null, 0, 0, 0, 2, 1);
print ajax_constantonoff('STOCK_CALCULATE_ON_RECEPTION', array(), null, 0, 0, 0, 2, 1, '', '', 'reposition');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_CALCULATE_ON_RECEPTION", $arrval, $conf->global->STOCK_CALCULATE_ON_RECEPTION);
@ -345,7 +361,7 @@ if (isModEnabled("reception")) {
print '<td class="right">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_CALCULATE_ON_RECEPTION_CLOSE', array(), null, 0, 0, 0, 2, 1);
print ajax_constantonoff('STOCK_CALCULATE_ON_RECEPTION_CLOSE', array(), null, 0, 0, 0, 2, 1, '', '', 'reposition');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_CALCULATE_ON_RECEPTION_CLOSE", $arrval, $conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE);
@ -358,7 +374,7 @@ if (isModEnabled("reception")) {
print '<td class="right">';
if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order")) {
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER', array(), null, 0, 0, 0, 2, 1);
print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER', array(), null, 0, 0, 0, 2, 1, '', '', 'reposition');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER);

View File

@ -487,7 +487,7 @@ if (empty($conf->api->enabled) && empty($conf->webservices->enabled)) {
print '<br>';
}
if (!empty($conf->api->enabled)) {
print '<strong>API_ENDPOINT_RULES</strong> = '.(empty($conf->global->API_ENDPOINT_RULES) ? '<span class="opacitymedium">'.$langs->trans("Undefined").' &nbsp; ('.$langs->trans("Example").': login:0,users:0,setup:1,status:1,tickets:1,...)</span>' : $conf->global->API_ENDPOINT_RULES)."<br>\n";
print '<strong>API_ENDPOINT_RULES</strong> = '.getDolGlobalString('API_ENDPOINT_RULES', '<span class="opacitymedium">'.$langs->trans("Undefined").' &nbsp; ('.$langs->trans("Example").': login:0,users:0,setup:1,status:1,tickets:1,...)</span>')."<br>\n";
print '<br>';
}
}
@ -501,19 +501,19 @@ print '<br>';
print load_fiche_titre($langs->trans("OtherSetup"), '', 'folder');
print '<strong>MAIN_ALLOW_SVG_FILES_AS_IMAGES</strong> = '.(empty($conf->global->MAIN_ALLOW_SVG_FILES_AS_IMAGES) ? '0' : $conf->global->MAIN_ALLOW_SVG_FILES_AS_IMAGES).' &nbsp; <span class="opacitymedium">('.$langs->trans("Recommended").': 0)</span><br>';
print '<strong>MAIN_ALLOW_SVG_FILES_AS_IMAGES</strong> = '.getDolGlobalString('MAIN_ALLOW_SVG_FILES_AS_IMAGES', '0').' &nbsp; <span class="opacitymedium">('.$langs->trans("Recommended").': 0)</span><br>';
print '<br>';
print '<strong>MAIN_ALWAYS_CREATE_LOCK_AFTER_LAST_UPGRADE</strong> = '.(empty($conf->global->MAIN_ALWAYS_CREATE_LOCK_AFTER_LAST_UPGRADE) ? '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>' : $conf->global->MAIN_ALWAYS_CREATE_LOCK_AFTER_LAST_UPGRADE).' &nbsp; <span class="opacitymedium">('.$langs->trans("Recommended").': 1)</span><br>';
print '<strong>MAIN_ALWAYS_CREATE_LOCK_AFTER_LAST_UPGRADE</strong> = '.getDolGlobalString('MAIN_ALWAYS_CREATE_LOCK_AFTER_LAST_UPGRADE', '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>').' &nbsp; <span class="opacitymedium">('.$langs->trans("Recommended").': 1)</span><br>';
print '<br>';
//print '<strong>'.$langs->trans("PasswordEncryption").'</strong>: ';
print '<strong>MAIN_SECURITY_HASH_ALGO</strong> = '.(empty($conf->global->MAIN_SECURITY_HASH_ALGO) ? '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>' : $conf->global->MAIN_SECURITY_HASH_ALGO)." &nbsp; ";
print '<strong>MAIN_SECURITY_HASH_ALGO</strong> = '.getDolGlobalString('MAIN_SECURITY_HASH_ALGO', '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>')." &nbsp; ";
if (empty($conf->global->MAIN_SECURITY_HASH_ALGO)) {
print '<span class="opacitymedium"> &nbsp; &nbsp; If unset: \'md5\'</span>';
}
if ($conf->global->MAIN_SECURITY_HASH_ALGO != 'password_hash') {
print '<br><strong>MAIN_SECURITY_SALT</strong> = '.(empty($conf->global->MAIN_SECURITY_SALT) ? '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>' : $conf->global->MAIN_SECURITY_SALT).'<br>';
print '<br><strong>MAIN_SECURITY_SALT</strong> = '.getDolGlobalString('MAIN_SECURITY_SALT', '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>').'<br>';
} else {
print '<span class="opacitymedium">('.$langs->trans("Recommended").': password_hash)</span>';
print '<br>';
@ -528,10 +528,10 @@ if ($conf->global->MAIN_SECURITY_HASH_ALGO != 'password_hash') {
}
print '<br>';
print '<strong>MAIN_SECURITY_ANTI_SSRF_SERVER_IP</strong> = '.(empty($conf->global->MAIN_SECURITY_ANTI_SSRF_SERVER_IP) ? '<span class="opacitymedium">'.$langs->trans("Undefined").'</span> &nbsp; <span class="opacitymedium">('.$langs->trans("Recommended").': List of static IPs of server separated with coma - '.$langs->trans("Note").': common loopback ip like 127.*.*.*, [::1] are already added)</span>' : $conf->global->MAIN_SECURITY_ANTI_SSRF_SERVER_IP)."<br>";
print '<strong>MAIN_SECURITY_ANTI_SSRF_SERVER_IP</strong> = '.getDolGlobalString('MAIN_SECURITY_ANTI_SSRF_SERVER_IP', '<span class="opacitymedium">'.$langs->trans("Undefined").'</span> &nbsp; <span class="opacitymedium">('.$langs->trans("Recommended").': List of static IPs of server separated with coma - '.$langs->trans("Note").': common loopback ip like 127.*.*.*, [::1] are already added)</span>')."<br>";
print '<br>';
print '<strong>MAIN_SECURITY_CSRF_WITH_TOKEN</strong> = '.(empty($conf->global->MAIN_SECURITY_CSRF_WITH_TOKEN) ? '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>' : $conf->global->MAIN_SECURITY_CSRF_WITH_TOKEN).' &nbsp; <span class="opacitymedium">('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or").' 2)</span>'."<br>";
print '<strong>MAIN_SECURITY_CSRF_WITH_TOKEN</strong> = '.getDolGlobalString('MAIN_SECURITY_CSRF_WITH_TOKEN', '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>').' &nbsp; <span class="opacitymedium">('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or").' 2)</span>'."<br>";
print '<br>';
print '<br>';
@ -559,31 +559,32 @@ if ($execmethod == 2) {
print '<br>';
print '<br>';
print '<strong>MAIN_RESTRICTHTML_ONLY_VALID_HTML</strong> = '.(empty($conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML) ? '<span class="opacitymedium">'.$langs->trans("Undefined").' &nbsp; ('.$langs->trans("Recommended").': 1)</span>' : $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML)."<br>";
print '<strong>MAIN_RESTRICTHTML_ONLY_VALID_HTML</strong> = '.getDolGlobalString('MAIN_RESTRICTHTML_ONLY_VALID_HTML', '<span class="opacitymedium">'.$langs->trans("Undefined").' &nbsp; ('.$langs->trans("Recommended").': 1)</span>')."<br>";
print '<br>';
print '<strong>MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES</strong> = '.(empty($conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES) ? '<span class="opacitymedium">'.$langs->trans("Undefined").' &nbsp; ('.$langs->trans("Recommended").': 1)</span>' : $conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES)."<br>";
print '<strong>MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES</strong> = '.getDolGlobalString('MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES', '<span class="opacitymedium">'.$langs->trans("Undefined").' &nbsp; ('.$langs->trans("Recommended").': 1)</span>')."<br>";
print '<br>';
print '<strong>MAIN_SECURITY_CSRF_TOKEN_RENEWAL_ON_EACH_CALL</strong> = '.(empty($conf->global->MAIN_SECURITY_CSRF_TOKEN_RENEWAL_ON_EACH_CALL) ? '<span class="opacitymedium">'.$langs->trans("Undefined").' &nbsp; ('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or").' 0)</span>' : $conf->global->MAIN_SECURITY_CSRF_TOKEN_RENEWAL_ON_EACH_CALL)."<br>";
print '<strong>MAIN_SECURITY_CSRF_TOKEN_RENEWAL_ON_EACH_CALL</strong> = '.getDolGlobalString('MAIN_SECURITY_CSRF_TOKEN_RENEWAL_ON_EACH_CALL', '<span class="opacitymedium">'.$langs->trans("Undefined").' &nbsp; ('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or").' 0)</span>')."<br>";
print '<br>';
print '<strong>MAIN_SECURITY_FORCECSP</strong> = '.(empty($conf->global->MAIN_SECURITY_FORCECSP) ? '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>' : $conf->global->MAIN_SECURITY_FORCECSP).' &nbsp; <span class="opacitymedium">('.$langs->trans("Example").": \"frame-ancestors 'self'; default-src 'self'; img-src *;\")</span><br>";
print '<strong>MAIN_SECURITY_FORCECSP</strong> = '.getDolGlobalString('MAIN_SECURITY_FORCECSP', '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>').' &nbsp; <span class="opacitymedium">('.$langs->trans("Example").": \"frame-ancestors 'self'; default-src 'self'; img-src *;\")</span><br>";
print '<br>';
print '<strong>MAIN_SECURITY_FORCERP</strong> = '.(empty($conf->global->MAIN_SECURITY_FORCERP) ? '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>' : $conf->global->MAIN_SECURITY_FORCERP).' &nbsp; <span class="opacitymedium">('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or")." \"same-origin\" so browser doesn't send any referrer when going into another web site domain)</span><br>";
print '<strong>MAIN_SECURITY_FORCERP</strong> = '.getDolGlobalString('MAIN_SECURITY_FORCERP', '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>').' &nbsp; <span class="opacitymedium">('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or")." \"same-origin\" so browser doesn't send any referrer when going into another web site domain)</span><br>";
print '<br>';
print '<strong>WEBSITE_MAIN_SECURITY_FORCECSP</strong> = '.(empty($conf->global->WEBSITE_MAIN_SECURITY_FORCECSP) ? '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>' : $conf->global->WEBSITE_MAIN_SECURITY_FORCECSP).' &nbsp; <span class="opacitymedium">('.$langs->trans("Example").": \"frame-ancestors 'self'; default-src 'self'; style-src https://cdnjs.cloudflare.com https://fonts.googleapis.com; script-src https://cdn.transifex.com https://www.googletagmanager.com; object-src https://youtube.com; frame-src https://youtube.com; img-src *;\")</span><br>";
print '<strong>WEBSITE_MAIN_SECURITY_FORCECSP</strong> = '.getDolGlobalString('WEBSITE_MAIN_SECURITY_FORCECSP', '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>');
print ' &nbsp; <span class="opacitymedium">('.$langs->trans("Example").": \"frame-ancestors 'self'; default-src 'self'; style-src https://cdnjs.cloudflare.com https://fonts.googleapis.com; script-src https://cdn.transifex.com https://www.googletagmanager.com; object-src https://youtube.com; frame-src https://youtube.com; img-src *;\")</span><br>";
print '<br>';
print '<strong>WEBSITE_MAIN_SECURITY_FORCERP</strong> = '.(empty($conf->global->WEBSITE_MAIN_SECURITY_FORCERP) ? '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>' : $conf->global->WEBSITE_MAIN_SECURITY_FORCERP).' &nbsp; <span class="opacitymedium">('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or")." \"strict-origin-when-cross-origin\")</span><br>";
print '<strong>WEBSITE_MAIN_SECURITY_FORCERP</strong> = '.getDolGlobalString('WEBSITE_MAIN_SECURITY_FORCERP', '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>').' &nbsp; <span class="opacitymedium">('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or")." \"strict-origin-when-cross-origin\")</span><br>";
print '<br>';
print '<strong>WEBSITE_MAIN_SECURITY_FORCESTS</strong> = '.(empty($conf->global->WEBSITE_MAIN_SECURITY_FORCESTS) ? '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>' : $conf->global->WEBSITE_MAIN_SECURITY_FORCESTS).' &nbsp; <span class="opacitymedium">('.$langs->trans("Example").": \"max-age=31536000; includeSubDomains\")</span><br>";
print '<strong>WEBSITE_MAIN_SECURITY_FORCESTS</strong> = '.getDolGlobalString('>WEBSITE_MAIN_SECURITY_FORCESTS', '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>').' &nbsp; <span class="opacitymedium">('.$langs->trans("Example").": \"max-age=31536000; includeSubDomains\")</span><br>";
print '<br>';
print '<strong>WEBSITE_MAIN_SECURITY_FORCEPP</strong> = '.(empty($conf->global->WEBSITE_MAIN_SECURITY_FORCEPP) ? '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>' : $conf->global->WEBSITE_MAIN_SECURITY_FORCEPP).' &nbsp; <span class="opacitymedium">('.$langs->trans("Example").": \"camera: 'none'; microphone: 'none';\")</span><br>";
print '<strong>WEBSITE_MAIN_SECURITY_FORCEPP</strong> = '.getDolGlobalString('WEBSITE_MAIN_SECURITY_FORCEPP', '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>').' &nbsp; <span class="opacitymedium">('.$langs->trans("Example").": \"camera: 'none'; microphone: 'none';\")</span><br>";
print '<br>';
print '<br>';
@ -598,16 +599,13 @@ print '</span>';
print '<br>';
$urlexamplebase = 'https://github.com/Dolibarr/dolibarr/blob/develop/dev/setup/fail2ban/filter.d/';
print '- Login process (see <a target="_blank" rel="noopener" href="'.$urlexamplebase.'web-dolibarr-rulesbruteforce.conf">fail2ban example on GitHub</a>)<br>';
print '- '.DOL_URL_ROOT.'/passwordforgotten.php (see <a target="_blank" rel="noopener" href="'.$urlexamplebase.'web-dolibarr-rulespassgorgotten.conf">fail2ban example on GitHub</a>)<br>';
print '- '.DOL_URL_ROOT.'/passwordforgotten.php (see <a target="_blank" rel="noopener" href="'.$urlexamplebase.'web-dolibarr-rulespassforgotten.conf">fail2ban example on GitHub</a>)<br>';
print '- '.DOL_URL_ROOT.'/public/* (see <a target="_blank" rel="noopener" href="'.$urlexamplebase.'web-dolibarr-limitpublic.conf">fail2ban example on GitHub</a>)<br>';
print '<br>';
$urlexamplebase = 'https://github.com/Dolibarr/dolibarr/blob/develop/dev/setup/apache/';
print '- You can also protect the application using a HTTP Basic authentication layer (see <a target="_blank" rel="noopener" href="'.$urlexamplebase.'virtualhost">apache2 virtualhost example on GitHub</a>)<br>';
// End of page
llxFooter();
$db->close();

View File

@ -68,16 +68,14 @@ $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
* Actions
*/
if ((float) DOL_VERSION >= 6) {
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
}
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
if ($action == 'updateMask') {
$maskconstorder = GETPOST('maskconstorder', 'alpha');
$maskorder = GETPOST('maskorder', 'alpha');
$maskconst = GETPOST('maskconst', 'alpha');
$mask = GETPOST('mask', 'alpha');
if ($maskconstorder) {
$res = dolibarr_set_const($db, $maskconstorder, $maskorder, 'chaine', 0, '', $conf->entity);
if ($maskconst) {
$res = dolibarr_set_const($db, $maskconst, $mask, 'chaine', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
}
@ -206,7 +204,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
}
if ($myTmpObjectArray['includerefgeneration']) {
/*
* Orders Numbering model
* Assets Numbering model
*/
$setupnotempty++;

View File

@ -176,9 +176,9 @@ if ($action === 'downloadblockchain') {
if (!$error) {
// Now restart request with all data = no limit(1) in sql request
$sql = "SELECT rowid,date_creation,tms,user_fullname,action,amounts,element,fk_object,date_object,ref_object,signature,fk_user,object_data";
$sql = "SELECT rowid, date_creation, tms, user_fullname, action, amounts, element, fk_object, date_object, ref_object, signature, fk_user, object_data, object_version";
$sql .= " FROM ".MAIN_DB_PREFIX."blockedlog";
$sql .= " WHERE entity = ".$conf->entity;
$sql .= " WHERE entity = ".((int) $conf->entity);
if (GETPOST('monthtoexport', 'int') > 0 || GETPOST('yeartoexport', 'int') > 0) {
$dates = dol_get_first_day(GETPOST('yeartoexport', 'int'), GETPOST('monthtoexport', 'int') ?GETPOST('monthtoexport', 'int') : 1);
$datee = dol_get_last_day(GETPOST('yeartoexport', 'int'), GETPOST('monthtoexport', 'int') ?GETPOST('monthtoexport', 'int') : 12);
@ -204,6 +204,7 @@ if ($action === 'downloadblockchain') {
.';'.$langs->transnoentities('Fingerprint')
.';'.$langs->transnoentities('Status')
.';'.$langs->transnoentities('Note')
.';'.$langs->transnoentities('Version')
.';'.$langs->transnoentities('FullData')
."\n";
@ -226,6 +227,7 @@ if ($action === 'downloadblockchain') {
$block_static->fk_user = $obj->fk_user;
$block_static->signature = $obj->signature;
$block_static->object_data = $block_static->dolDecodeBlockedData($obj->object_data);
$block_static->object_version = $obj->object_version;
$checksignature = $block_static->checkSignature($previoushash); // If $previoushash is not defined, checkSignature will search it
@ -257,6 +259,7 @@ if ($action === 'downloadblockchain') {
print ';'.$obj->signature;
print ';'.$statusofrecord;
print ';'.$statusofrecordnote;
print ';'.$obj->object_version;
print ';"'.str_replace('"', '""', $obj->object_data).'"';
print "\n";
@ -448,8 +451,8 @@ print '<td class="liste_titre"></td>';
// Status
print '<td class="liste_titre">';
$array = array("1"=>$langs->trans("OnlyNonValid"));
print $form->selectarray('search_showonlyerrors', $array, $search_showonlyerrors, 1);
$array = array("1" => "OnlyNonValid");
print $form->selectarray('search_showonlyerrors', $array, $search_showonlyerrors, 1, 0, 0, '', 1, 0, 0, 'ASC', 'search_status maxwidth200 onrightofpage', 1);
print '</td>';
// Status note
@ -530,7 +533,7 @@ if (is_array($blocks)) {
print '<td>'.dol_escape_htmltag($block->id).'</td>';
// Date
print '<td>'.dol_print_date($block->date_creation, 'dayhour').'</td>';
print '<td class="nowraponall">'.dol_print_date($block->date_creation, 'dayhour').'</td>';
// User
print '<td>';

View File

@ -57,7 +57,7 @@ $langs->loadLangs(array("admin"));
top_httphead();
print '<div id="pop-info"><table width="100%" height="80%" class="border"><thead><th width="50%" class="left">'.$langs->trans('Field').'</th><th class="left">'.$langs->trans('Value').'</th></thead>';
print '<div id="pop-info"><table height="80%" class="border centpercent"><thead><th width="50%" class="left">'.$langs->trans('Field').'</th><th class="left">'.$langs->trans('Value').'</th></thead>';
print '<tbody>';
if ($block->fetch($id) > 0) {

View File

@ -204,6 +204,7 @@ class BlockedLog
}
// Add more action to track from a conf variable
// For example: STOCK_MOVEMENT,...
if (!empty($conf->global->BLOCKEDLOG_ADD_ACTIONS_SUPPORTED)) {
$tmparrayofmoresupportedevents = explode(',', $conf->global->BLOCKEDLOG_ADD_ACTIONS_SUPPORTED);
foreach ($tmparrayofmoresupportedevents as $val) {
@ -305,6 +306,15 @@ class BlockedLog
} else {
$this->error++;
}
} elseif ($this->element === 'stockmouvement') {
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
$object = new MouvementStock($this->db);
if ($object->fetch($this->fk_object) > 0) {
return $object->getNomUrl(1);
} else {
$this->error++;
}
} elseif ($this->action == 'MODULE_SET') {
return '<i class="opacitymedium">'.$langs->trans("BlockedLogEnabled").'</i>';
} elseif ($this->action == 'MODULE_RESET') {
@ -378,9 +388,14 @@ class BlockedLog
$this->date_object = $object->dateh;
} elseif ($object->element == 'cashcontrol') {
$this->date_object = $object->date_creation;
} else {
} elseif (property_exists($object, 'date')) {
// Generic case
$this->date_object = $object->date;
} elseif (property_exists($object, 'datem')) {
// Generic case (second chance, for example for stock movement)
$this->date_object = $object->datem;
}
// ref
$this->ref_object = ((!empty($object->newref)) ? $object->newref : $object->ref); // newref is set when validating a draft, ref is set in other cases
// type of object
@ -395,11 +410,18 @@ class BlockedLog
$arrayoffieldstoexclude = array(
'table_element', 'fields', 'ref_previous', 'ref_next', 'origin', 'origin_id', 'oldcopy', 'picto', 'error', 'errors', 'model_pdf', 'modelpdf', 'last_main_doc', 'civility_id', 'contact', 'contact_id',
'table_element_line', 'ismultientitymanaged', 'isextrafieldmanaged',
'array_languages',
'childtables',
'contact_ids',
'context',
'labelStatus',
'labelStatusShort',
'linkedObjectsIds',
'linkedObjects',
'fk_delivery_address',
'context',
'projet' // There is already ->fk_project
'projet', // There is already ->fk_project
'restrictiononfksoc',
'specimen',
);
// Add more fields to exclude depending on object type
if ($this->element == 'cashcontrol') {
@ -428,7 +450,7 @@ class BlockedLog
continue; // Discard if not into a dedicated list
}
if (!is_object($value) && !is_null($value) && $value !== '') {
$this->object_data->thirdparty->{$key} = $value;
$this->object_data->thirdparty->$key = $value;
}
}
}
@ -448,7 +470,7 @@ class BlockedLog
continue; // Discard if not into a dedicated list
}
if (!is_object($value) && !is_null($value) && $value !== '') {
$this->object_data->mycompany->{$key} = $value;
$this->object_data->mycompany->$key = $value;
}
}
}
@ -486,12 +508,12 @@ class BlockedLog
}
if (!is_object($valueline) && !is_null($valueline) && $valueline !== '') {
$this->object_data->invoiceline[$lineid]->{$keyline} = $valueline;
$this->object_data->invoiceline[$lineid]->$keyline = $valueline;
}
}
}
} elseif (!is_object($value) && !is_null($value) && $value !== '') {
$this->object_data->{$key} = $value;
$this->object_data->$key = $value;
}
}
@ -509,7 +531,7 @@ class BlockedLog
continue; // Discard if not into a dedicated list
}
if (!is_object($value) && !is_null($value) && $value !== '') {
$this->object_data->{$key} = $value;
$this->object_data->$key = $value;
}
}
@ -601,7 +623,7 @@ class BlockedLog
continue; // Discard if not into a dedicated list
}
if (!is_object($value) && !is_null($value) && $value !== '') {
$paymentpart->thirdparty->{$key} = $value;
$paymentpart->thirdparty->$key = $value;
}
}
}
@ -625,11 +647,11 @@ class BlockedLog
}
if (!is_object($value) && !is_null($value) && $value !== '') {
if ($this->element == 'payment_donation') {
$paymentpart->donation->{$key} = $value;
$paymentpart->donation->$key = $value;
} elseif ($this->element == 'payment_various') {
$paymentpart->various->{$key} = $value;
$paymentpart->various->$key = $value;
} else {
$paymentpart->invoice->{$key} = $value;
$paymentpart->invoice->$key = $value;
}
}
}
@ -664,21 +686,30 @@ class BlockedLog
continue; // Discard if not into a dedicated list
}
if (!is_object($value) && !is_null($value) && $value !== '') {
$this->object_data->{$key} = $value;
$this->object_data->$key = $value;
}
}
if (!empty($object->newref)) {
$this->object_data->ref = $object->newref;
}
} else // Generic case
{
} elseif ($this->element == 'stockmouvement') {
foreach ($object as $key => $value) {
if (in_array($key, $arrayoffieldstoexclude)) {
continue; // Discard some properties
}
if (!is_object($value) && !is_null($value) && $value !== '') {
$this->object_data->{$key} = $value;
$this->object_data->$key = $value;
}
}
} else {
// Generic case
foreach ($object as $key => $value) {
if (in_array($key, $arrayoffieldstoexclude)) {
continue; // Discard some properties
}
if (!is_object($value) && !is_null($value) && $value !== '') {
$this->object_data->$key = $value;
}
}
@ -687,6 +718,10 @@ class BlockedLog
}
}
// A trick to be sure all the object_data is an associative array
// json_encode and json_decode are not able to manage mixed object (with array/object, only full arrays or full objects)
$this->object_data = json_decode(json_encode($this->object_data, JSON_FORCE_OBJECT), false);
return 1;
}
@ -754,21 +789,42 @@ class BlockedLog
}
/**
* Encode data
*
* @param string $data Data to serialize
* @param string $mode 0=serialize, 1=json_encode
* @return string Value serialized, an object (stdClass)
*/
public function dolEncodeBlockedData($data, $mode = 0)
{
try {
$aaa = json_encode($data);
} catch (Exception $e) {
//print $e->getErrs);
}
//var_dump($aaa);
return $aaa;
}
/**
* Decode data
*
* @param string $data Data to unserialize
* @param string $mode 0=unserialize, 1=json_decode
* @return string Value unserialized
* @return object Value unserialized, an object (stdClass)
*/
public function dolDecodeBlockedData($data, $mode = 0)
{
try {
//include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$aaa = unserialize($data);
$aaa = (object) jsonOrUnserialize($data);
} catch (Exception $e) {
//print $e->getErrs);
}
//var_dump($aaa);
return $aaa;
}
@ -833,6 +889,9 @@ class BlockedLog
$this->date_creation = dol_now();
$this->object_version = ((float) DOL_VERSION);
$this->db->begin();
$previoushash = $this->getPreviousHash(1, 0); // This get last record and lock database until insert is done
@ -874,7 +933,7 @@ class BlockedLog
$sql .= $this->fk_object.",";
$sql .= "'".$this->db->idate($this->date_object)."',";
$sql .= "'".$this->db->escape($this->ref_object)."',";
$sql .= "'".$this->db->escape(serialize($this->object_data))."',";
$sql .= "'".$this->db->escape($this->dolEncodeBlockedData($this->object_data))."',";
$sql .= "'".$this->db->escape($this->object_version)."',";
$sql .= "0,";
$sql .= $this->fk_user.",";
@ -882,6 +941,14 @@ class BlockedLog
$sql .= ($this->entity ? $this->entity : $conf->entity);
$sql .= ")";
/*
$a = serialize($this->object_data); $a2 = unserialize($a); $a4 = print_r($a2, true);
$b = json_encode($this->object_data); $b2 = json_decode($b); $b4 = print_r($b2, true);
var_dump($a4 == print_r($this->object_data, true) ? 'a=a' : 'a not = a');
var_dump($b4 == print_r($this->object_data, true) ? 'b=b' : 'b not = b');
exit;
*/
$res = $this->db->query($sql);
if ($res) {
$id = $this->db->last_insert_id(MAIN_DB_PREFIX."blockedlog");
@ -921,7 +988,7 @@ class BlockedLog
$keyforsignature = $this->buildKeyForSignature();
//$signature_line = dol_hash($keyforsignature, '5'); // Not really usefull
$signature = dol_hash($previoushash.$keyforsignature, '5');
$signature = dol_hash($previoushash.$keyforsignature, 'sha256');
//var_dump($previoushash); var_dump($keyforsignature); var_dump($signature_line); var_dump($signature);
$res = ($signature === $this->signature);
@ -953,8 +1020,8 @@ class BlockedLog
private function buildKeyForSignature()
{
//print_r($this->object_data);
if (((int) $this->object_version) > 12) {
return $this->date_creation.'|'.$this->action.'|'.$this->amounts.'|'.$this->ref_object.'|'.$this->date_object.'|'.$this->user_fullname.'|'.print_r($this->object_data, true);
if (((int) $this->object_version) >= 18) {
return $this->date_creation.'|'.$this->action.'|'.$this->amounts.'|'.$this->ref_object.'|'.$this->date_object.'|'.$this->user_fullname.'|'.json_encode($this->object_data, JSON_FORCE_OBJECT);
} else {
return $this->date_creation.'|'.$this->action.'|'.$this->amounts.'|'.$this->ref_object.'|'.$this->date_object.'|'.$this->user_fullname.'|'.print_r($this->object_data, true);
}
@ -975,7 +1042,7 @@ class BlockedLog
$previoussignature = '';
$sql = "SELECT rowid, signature FROM ".MAIN_DB_PREFIX."blockedlog";
$sql .= " WHERE entity=".$conf->entity;
$sql .= " WHERE entity = ".((int) $conf->entity);
if ($beforeid) {
$sql .= " AND rowid < ".(int) $beforeid;
}
@ -1036,7 +1103,7 @@ class BlockedLog
WHERE entity=".$conf->entity." AND certified = 1";
} else {
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."blockedlog
WHERE entity=".$conf->entity." AND element='".$this->db->escape($element)."'";
WHERE entity=".$conf->entity." AND element = '".$this->db->escape($element)."'";
}
if ($fk_object) {

View File

@ -42,6 +42,8 @@ $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'bomlist'; // To manage different context of search
$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
$mode = GETPOST('mode', 'alpha'); // mode view (kanban or common)
// Load variable for pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
@ -433,6 +435,9 @@ llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', '');
$arrayofselected = is_array($toselect) ? $toselect : array();
$param = '';
if (!empty($mode)) {
$param .= '&mode='.urlencode($mode);
}
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}
@ -483,7 +488,11 @@ print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print '<input type="hidden" name="mode" value="'.$mode.'">';
$newcardbutton .= '';
$newcardbutton = dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition'));
$newcardbutton = dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition'));
$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/bom/bom_card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $user->rights->bom->write);
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_'.$object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
@ -555,7 +564,7 @@ foreach ($object->fields as $key => $val) {
if (!empty($arrayfields['t.'.$key]['checked'])) {
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100'.($key == 'status' ? ' search_status onrightofpage' : ''), 1);
} elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) {
print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', 'maxwidth125', 1);
} elseif (!preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
@ -648,90 +657,106 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
// Store properties in $object
$object->setVarsFromFetchObj($obj);
// Show here line of result
print '<tr class="oddeven">';
// Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="nowrap center">';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($object->id, $arrayofselected)) {
$selected = 1;
}
print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
}
print '</td>';
}
foreach ($object->fields as $key => $val) {
$cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
$cssforfield .= ($cssforfield ? ' ' : '').'center';
} elseif ($key == 'status') {
$cssforfield .= ($cssforfield ? ' ' : '').'center';
// mode view kanban
if ($mode == 'kanban') {
if ($i == 0) {
print '<tr><td colspan="12">';
print '<div class="box-flex-container">';
}
if (in_array($val['type'], array('timestamp'))) {
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
} elseif ($key == 'ref') {
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
}
print $object->getKanbanView('');
if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'status')) && empty($val['arrayofkeyval'])) {
$cssforfield .= ($cssforfield ? ' ' : '').'right';
}
if (!empty($arrayfields['t.'.$key]['checked'])) {
print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '').'>';
if ($key == 'status') {
print $object->getLibStatut(5);
} elseif ($key == 'rowid') {
print $object->showOutputField($val, $key, $object->id, '');
} else {
print $object->showOutputField($val, $key, $object->$key, '');
if ($i == min($num, $limit)-1) {
print '</div>';
print '</td></tr>';
}
} else {
// Show here line of result
print '<tr class="oddeven">';
// Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="nowrap center">';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($object->id, $arrayofselected)) {
$selected = 1;
}
print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
foreach ($object->fields as $key => $val) {
$cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
$cssforfield .= ($cssforfield ? ' ' : '').'center';
} elseif ($key == 'status') {
$cssforfield .= ($cssforfield ? ' ' : '').'center';
}
if (!empty($val['isameasure']) && $val['isameasure'] == 1) {
if (in_array($val['type'], array('timestamp'))) {
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
} elseif ($key == 'ref') {
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
}
if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'status')) && empty($val['arrayofkeyval'])) {
$cssforfield .= ($cssforfield ? ' ' : '').'right';
}
if (!empty($arrayfields['t.'.$key]['checked'])) {
print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '').'>';
if ($key == 'status') {
print $object->getLibStatut(5);
} elseif ($key == 'rowid') {
print $object->showOutputField($val, $key, $object->id, '');
} else {
print $object->showOutputField($val, $key, $object->$key, '');
}
print '</td>';
if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
$totalarray['nbfield']++;
}
if (!isset($totalarray['val'])) {
$totalarray['val'] = array();
if (!empty($val['isameasure']) && $val['isameasure'] == 1) {
if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
}
if (!isset($totalarray['val'])) {
$totalarray['val'] = array();
}
if (!isset($totalarray['val']['t.'.$key])) {
$totalarray['val']['t.'.$key] = 0;
}
$totalarray['val']['t.'.$key] += $object->$key;
}
if (!isset($totalarray['val']['t.'.$key])) {
$totalarray['val']['t.'.$key] = 0;
}
$totalarray['val']['t.'.$key] += $object->$key;
}
}
}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action column
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="nowrap center">';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($object->id, $arrayofselected)) {
$selected = 1;
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action column
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="nowrap center">';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($object->id, $arrayofselected)) {
$selected = 1;
}
print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
}
print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
print '</td>';
}
if (!$i) {
$totalarray['nbfield']++;
}
print '</td>';
}
if (!$i) {
$totalarray['nbfield']++;
}
print '</tr>'."\n";
print '</tr>'."\n";
$i++;
$i++;
}
}
// Show total line

View File

@ -1515,6 +1515,46 @@ class BOM extends CommonObject
}
}
}
/**
* Return clicable link of object (with eventually picto)
*
* @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link)
* @return string HTML Code for Kanban thumb.
*/
public function getKanbanView($option = '')
{
global $db,$langs;
$prod = new Product($db);
$prod->fetch($this->fk_product);
$return = '<div class="box-flex-item box-flex-grow-zero">';
$return .= '<div class="info-box info-box-sm">';
$return .= '<span class="info-box-icon bg-infobox-action">';
$return .= img_picto('', $this->picto);
$return .= '</span>';
$return .= '<div class="info-box-content">';
$return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : '').'</span>';
if (property_exists($this, 'fields') && !empty($this->fields['bomtype']['arrayofkeyval'])) {
$return .= '<br><span class="info-box-label opacitymedium">'.$langs->trans("Type").' : </span>';
if ($this->bomtype == 0) {
$return .= '<span class="info-box-label">'.$this->fields['bomtype']['arrayofkeyval'][0].'</span>';
} else {
$return .= '<span class="info-box-label">'.$this->fields['bomtype']['arrayofkeyval'][1].'</span>';
}
}
if (property_exists($this, 'fk_product') && !is_null($this->fk_product)) {
$return .= '<br><span class="info-box-label">'.$prod->getNomUrl(1).'</span>';
}
if (method_exists($this, 'getLibStatut')) {
$return .= '<br><div class="info-box-status margintoponly">'.$this->getLibStatut(5).'</div>';
}
$return .= '</div>';
$return .= '</div>';
$return .= '</div>';
return $return;
}
}

View File

@ -1433,7 +1433,7 @@ class ActionComm extends CommonObject
$response->label = $langs->trans("ActionsToDo");
$response->labelShort = $langs->trans("ActionsToDoShort");
$response->url = DOL_URL_ROOT.'/comm/action/list.php?mode=show_list&actioncode=0&status=todo&mainmenu=agenda';
if ($user->rights->agenda->allactions->read) {
if ($user->hasRight("agenda", "allactions", "read")) {
$response->url .= '&filtert=-1';
}
$response->img = img_object('', "action", 'class="inline-block valigntextmiddle"');

View File

@ -274,7 +274,7 @@ if (empty($conf->global->AGENDA_DISABLE_EXT)) {
$color = 'AGENDA_EXT_COLOR'.$i;
$default = 'AGENDA_EXT_ACTIVEBYDEFAULT'.$i;
$buggedfile = 'AGENDA_EXT_BUGGEDFILE'.$i;
if (!empty($conf->global->$source) && !empty($conf->global->$name)) {
if (getDolGlobalString($source) && getDolGlobalString($name)) {
// Note: $conf->global->buggedfile can be empty or 'uselocalandtznodaylight' or 'uselocalandtzdaylight'
$listofextcals[] = array(
'src' => getDolGlobalString($source),
@ -299,14 +299,14 @@ if (empty($user->conf->AGENDA_DISABLE_EXT)) {
$enabled = 'AGENDA_EXT_ENABLED_'.$user->id.'_'.$i;
$default = 'AGENDA_EXT_ACTIVEBYDEFAULT_'.$user->id.'_'.$i;
$buggedfile = 'AGENDA_EXT_BUGGEDFILE_'.$user->id.'_'.$i;
if (!empty($user->conf->$source) && !empty($user->conf->$name)) {
if (getDolUserString($source) && getDolUserString($name)) {
// Note: $conf->global->buggedfile can be empty or 'uselocalandtznodaylight' or 'uselocalandtzdaylight'
$listofextcals[] = array(
'src' => $user->conf->$source,
'name' => dol_string_nohtmltag($user->conf->$name),
'src' => getDolUserString($source),
'name' => dol_string_nohtmltag(getDolUserString($name)),
'offsettz' => (int) (empty($user->conf->$offsettz) ? 0 : $user->conf->$offsettz),
'color' => dol_string_nohtmltag($user->conf->$color),
'default' => dol_string_nohtmltag($user->conf->$default),
'color' => dol_string_nohtmltag(getDolUserString($color)),
'default' => dol_string_nohtmltag(getDolUserString($default)),
'buggedfile' => dol_string_nohtmltag(isset($user->conf->buggedfile) ? $user->conf->buggedfile : '')
);
}
@ -1287,7 +1287,7 @@ if (count($listofextcals)) {
}
// Transparency (see https://www.kanzaki.com/docs/ical/transp.html)
if ($icalevent['TRANSP']) {
if (!empty($icalevent['TRANSP'])) {
if ($icalevent['TRANSP'] == "TRANSPARENT") {
$event->transparency = 0; // 0 = available / free
}

View File

@ -72,7 +72,12 @@ if ($user->socid > 0) {
} else {
$id = 0;
}
restrictedArea($user, 'societe', $id, '&societe', '', 'fk_soc', 'rowid', 0);
//restrictedArea($user, 'societe', $id, '&societe', '', 'fk_soc', 'rowid', 0);
if (!$user->hasRight('propal', 'read') && !$user->hasRight('supplier_proposal', 'read') && !$user->hasRight('commande', 'read') && !$user->hasRight('fournisseur', 'commande', 'read')
&& !$user->hasRight('supplier_order', 'read') && !$user->hasRight('fichinter', 'read')) {
accessforbidden();
}
$maxofloop = (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD);
@ -129,7 +134,7 @@ if ($tmp) {
* Draft customer proposals
*/
if (isModEnabled("propal") && $user->rights->propal->lire) {
if (isModEnabled("propal") && $user->hasRight("propal", "lire")) {
$sql = "SELECT p.rowid, p.ref, p.ref_client, p.total_ht, p.total_tva, p.total_ttc, p.fk_statut as status";
$sql .= ", s.rowid as socid, s.nom as name, s.name_alias";
$sql .= ", s.code_client, s.code_compta, s.client";
@ -227,7 +232,7 @@ if (isModEnabled("propal") && $user->rights->propal->lire) {
* Draft supplier proposals
*/
if (isModEnabled('supplier_proposal') && $user->rights->supplier_proposal->lire) {
if (isModEnabled('supplier_proposal') && $user->hasRight("supplier_proposal", "lire")) {
$sql = "SELECT p.rowid, p.ref, p.total_ht, p.total_tva, p.total_ttc, p.fk_statut as status";
$sql .= ", s.rowid as socid, s.nom as name, s.name_alias";
$sql .= ", s.code_client, s.code_compta, s.client";
@ -422,7 +427,7 @@ if (isModEnabled('commande') && $user->rights->commande->lire) {
* Draft purchase orders
*/
if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->commande->lire) || (isModEnabled("supplier_order") && $user->rights->supplier_order->lire)) {
if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "commande", "lire")) || (isModEnabled("supplier_order") && $user->hasRight("supplier_order", "lire"))) {
$sql = "SELECT cf.rowid, cf.ref, cf.ref_supplier, cf.total_ht, cf.total_tva, cf.total_ttc, cf.fk_statut as status";
$sql .= ", s.rowid as socid, s.nom as name, s.name_alias";
$sql .= ", s.code_client, s.code_compta, s.client";
@ -517,7 +522,7 @@ if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMO
/*
* Draft interventionals
* Draft interventions
*/
if (isModEnabled('ficheinter')) {
$sql = "SELECT f.rowid, f.ref, s.nom as name, f.fk_statut";
@ -546,13 +551,12 @@ if (isModEnabled('ficheinter')) {
if ($resql) {
$num = $db->num_rows($resql);
$nbofloop = min($num, $maxofloop);
startSimpleTable("DraftFichinter", "fichinter/list.php", "search_status=".Fichinter::STATUS_DRAFT, 2, $num);
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<th colspan="2">'.$langs->trans("DraftFichinter").'</th></tr>';
//print '<tr class="liste_titre">';
//print '<th colspan="2">'.$langs->trans("DraftFichinter").'</th></tr>';
if ($num) {
if ($num > 0) {
$i = 0;
while ($i < $nbofloop) {
$obj = $db->fetch_object($resql);
@ -585,6 +589,10 @@ if (isModEnabled('ficheinter')) {
$i++;
}
}
addSummaryTableLine(3, $num, $nbofloop, $total, "NoIntervention");
finishSimpleTable(true);
print "</table></div>";
}
}
@ -811,7 +819,7 @@ if (((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERM
/*
* Latest contracts
*/
if (isModEnabled('contrat') && $user->rights->contrat->lire && 0) { // TODO A REFAIRE DEPUIS NOUVEAU CONTRAT
if (isModEnabled('contrat') && $user->hasRight("contrat", "lire") && 0) { // TODO A REFAIRE DEPUIS NOUVEAU CONTRAT
$staticcontrat = new Contrat($db);
$sql = "SELECT s.rowid as socid, s.nom as name, s.name_alias";
@ -889,7 +897,7 @@ if (isModEnabled('contrat') && $user->rights->contrat->lire && 0) { // TODO A RE
/*
* Opened (validated) proposals
*/
if (isModEnabled("propal") && $user->rights->propal->lire) {
if (isModEnabled("propal") && $user->hasRight("propal", "lire")) {
$sql = "SELECT p.rowid as propalid, p.entity, p.total_ttc, p.total_ht, p.total_tva, p.ref, p.ref_client, p.fk_statut, p.datep as dp, p.fin_validite as dfv";
$sql .= ", s.rowid as socid, s.nom as name, s.name_alias";
$sql .= ", s.code_client, s.code_compta, s.client";

View File

@ -369,7 +369,7 @@ if (empty($reshook)) {
}
if (!empty($conf->global->MAILING_DELAY)) {
dol_syslog("Wait a delay of MAILING_DELAY=".$conf->global->MAILING_DELAY);
dol_syslog("Wait a delay of MAILING_DELAY=".((float) $conf->global->MAILING_DELAY));
usleep((float) $conf->global->MAILING_DELAY * 1000000);
}

View File

@ -93,9 +93,6 @@ class PropaleStats extends Stats
}
//$this->where.= " AND p.fk_soc = s.rowid AND p.entity = ".$conf->entity;
$this->where .= ($this->where ? ' AND ' : '')."p.entity IN (".getEntity('propal').")";
if (empty($user->rights->societe->client->voir) && !$this->socid) {
$this->where .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
if ($this->socid) {
$this->where .= " AND p.fk_soc = ".((int) $this->socid);
}
@ -128,7 +125,7 @@ class PropaleStats extends Stats
$sql = "SELECT date_format(".$this->field_date.",'%m') as dm, COUNT(*) as nb";
$sql .= " FROM ".$this->from;
if (empty($user->rights->societe->client->voir) && !$user->socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON p.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
$sql .= $this->join;
$sql .= " WHERE ".$this->field_date." BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
@ -153,7 +150,7 @@ class PropaleStats extends Stats
$sql = "SELECT date_format(".$this->field_date.",'%Y') as dm, COUNT(*) as nb, SUM(c.".$this->field.")";
$sql .= " FROM ".$this->from;
if (empty($user->rights->societe->client->voir) && !$this->socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON p.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
$sql .= $this->join;
$sql .= " WHERE ".$this->where;
@ -177,7 +174,7 @@ class PropaleStats extends Stats
$sql = "SELECT date_format(".$this->field_date.",'%m') as dm, SUM(p.".$this->field.")";
$sql .= " FROM ".$this->from;
if (empty($user->rights->societe->client->voir) && !$this->socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON p.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
$sql .= $this->join;
$sql .= " WHERE ".$this->field_date." BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
@ -202,7 +199,7 @@ class PropaleStats extends Stats
$sql = "SELECT date_format(".$this->field_date.",'%m') as dm, AVG(p.".$this->field.")";
$sql .= " FROM ".$this->from;
if (empty($user->rights->societe->client->voir) && !$this->socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON p.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
$sql .= $this->join;
$sql .= " WHERE ".$this->field_date." BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
@ -225,7 +222,7 @@ class PropaleStats extends Stats
$sql = "SELECT date_format(".$this->field_date.",'%Y') as year, COUNT(*) as nb, SUM(".$this->field.") as total, AVG(".$this->field.") as avg";
$sql .= " FROM ".$this->from;
if (empty($user->rights->societe->client->voir) && !$this->socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON p.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
$sql .= $this->join;
$sql .= " WHERE ".$this->where;
@ -251,7 +248,7 @@ class PropaleStats extends Stats
$sql = "SELECT product.ref, COUNT(product.ref) as nb, SUM(tl.".$this->field_line.") as total, AVG(tl.".$this->field_line.") as avg";
$sql .= " FROM ".$this->from.", ".$this->from_line.", ".MAIN_DB_PREFIX."product as product";
if (empty($user->rights->societe->client->voir) && !$user->socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON p.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
$sql .= $this->join;
$sql .= " WHERE ".$this->where;

View File

@ -16,6 +16,7 @@
* Copyright (C) 2019-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2021 Anthony Berton <anthony.berton@bb2a.fr>
* Copyright (C) 2021 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2022 Josep Lluís Amador <joseplluis@lliuretic.cat>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -548,6 +549,9 @@ $companystatic = new Societe($db);
$projectstatic = new Project($db);
$formcompany = new FormCompany($db);
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
$title = $langs->trans('ListOfProposals');
$help_url = 'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos';
llxHeader('', $title, $help_url);
@ -607,7 +611,9 @@ $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as u ON p.fk_user_author = u.rowid';
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet as pr ON pr.rowid = p.fk_projet";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_availability as ava on (ava.rowid = p.fk_availability)";
// We'll need this table joined to the select in order to filter by sale
if ($search_sale > 0 || (empty($user->rights->societe->client->voir) && !$socid)) {
if ($search_sale == -2) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON (sc.fk_soc = p.fk_soc)";
} elseif ($search_sale > 0 || (empty($user->rights->societe->client->voir) && !$socid)) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
if ($search_user > 0) {
@ -656,11 +662,15 @@ if ($search_project) {
if ($search_availability) {
$sql .= " AND p.fk_availability IN (".$db->sanitize($db->escape($search_availability)).')';
}
if ($search_societe) {
$sql .= natural_search('s.nom', $search_societe);
}
if ($search_societe_alias) {
$sql .= natural_search('s.name_alias', $search_societe_alias);
if (empty($arrayfields['s.name_alias']['checked']) && $search_societe) {
$sql .= natural_search(array("s.nom", "s.name_alias"), $search_societe);
} else {
if ($search_societe) {
$sql .= natural_search('s.nom', $search_societe);
}
if ($search_societe_alias) {
$sql .= natural_search('s.name_alias', $search_societe_alias);
}
}
if ($search_login) {
$sql .= natural_search(array("u.login", "u.firstname", "u.lastname"), $search_login);
@ -739,7 +749,9 @@ if ($search_date_delivery_start) {
if ($search_date_delivery_end) {
$sql .= " AND p.date_livraison <= '".$db->idate($search_date_delivery_end)."'";
}
if ($search_sale > 0) {
if ($search_sale == -2) {
$sql .= " AND sc.fk_user IS NULL";
} elseif ($search_sale > 0) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $search_sale);
}
if ($search_user > 0) {
@ -1110,7 +1122,7 @@ if ($resql) {
$langs->load("commercial");
$moreforfilter .= '<div class="divsearchfield">';
$tmptitle = $langs->trans('ThirdPartiesOfSaleRepresentative');
$moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, $tmptitle, 'maxwidth250 widthcentpercentminusx');
$moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, $tmptitle, 'maxwidth250 widthcentpercentminusx', 1);
$moreforfilter .= '</div>';
}
// If the user can view prospects other than his'
@ -1777,7 +1789,7 @@ if ($resql) {
// Thirdparty
if (!empty($arrayfields['s.nom']['checked'])) {
print '<td class="tdoverflowmax150">';
print $companystatic->getNomUrl(1, 'customer');
print $companystatic->getNomUrl(1, 'customer', 0, 0, 1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1);
print '</td>';
if (!$i) {
$totalarray['nbfield']++;

View File

@ -1868,7 +1868,7 @@ if ($action == 'create' && $usercancreate) {
// Incoterms
if (isModEnabled('incoterm')) {
print '<tr>';
print '<td><label for="incoterm_id">'.$form->textwithpicto($langs->trans("IncotermLabel"), $objectsrc->label_incoterms, 1).'</label></td>';
print '<td><label for="incoterm_id">'.$form->textwithpicto($langs->trans("IncotermLabel"), !empty($objectsrc->fk_incoterms) ? $objectsrc->fk_incoterms : $soc->fk_incoterms, 1).'</label></td>';
print '<td class="maxwidthonsmartphone">';
$incoterm_id = GETPOST('incoterm_id');
$incoterm_location = GETPOST('location_incoterms');

View File

@ -93,9 +93,6 @@ class CommandeStats extends Stats
//$this->where.= " AND c.fk_soc = s.rowid AND c.entity = ".$conf->entity;
$this->where .= ($this->where ? ' AND ' : '').'c.entity IN ('.getEntity('commande').')';
if (empty($user->rights->societe->client->voir) && !$this->socid) {
$this->where .= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
if ($this->socid) {
$this->where .= " AND c.fk_soc = ".((int) $this->socid);
}
@ -127,7 +124,7 @@ class CommandeStats extends Stats
$sql = "SELECT date_format(c.date_commande,'%m') as dm, COUNT(*) as nb";
$sql .= " FROM ".$this->from;
if (empty($user->rights->societe->client->voir) && !$this->socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
$sql .= $this->join;
$sql .= " WHERE c.date_commande BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
@ -152,7 +149,7 @@ class CommandeStats extends Stats
$sql = "SELECT date_format(c.date_commande,'%Y') as dm, COUNT(*) as nb, SUM(c.".$this->field.")";
$sql .= " FROM ".$this->from;
if (empty($user->rights->societe->client->voir) && !$this->socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
$sql .= $this->join;
$sql .= " WHERE ".$this->where;
@ -176,7 +173,7 @@ class CommandeStats extends Stats
$sql = "SELECT date_format(c.date_commande,'%m') as dm, SUM(c.".$this->field.")";
$sql .= " FROM ".$this->from;
if (empty($user->rights->societe->client->voir) && !$this->socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
$sql .= $this->join;
$sql .= " WHERE c.date_commande BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
@ -201,7 +198,7 @@ class CommandeStats extends Stats
$sql = "SELECT date_format(c.date_commande,'%m') as dm, AVG(c.".$this->field.")";
$sql .= " FROM ".$this->from;
if (empty($user->rights->societe->client->voir) && !$this->socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
$sql .= $this->join;
$sql .= " WHERE c.date_commande BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
@ -224,7 +221,7 @@ class CommandeStats extends Stats
$sql = "SELECT date_format(c.date_commande,'%Y') as year, COUNT(*) as nb, SUM(c.".$this->field.") as total, AVG(".$this->field.") as avg";
$sql .= " FROM ".$this->from;
if (empty($user->rights->societe->client->voir) && !$this->socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
$sql .= $this->join;
$sql .= " WHERE ".$this->where;
@ -248,7 +245,7 @@ class CommandeStats extends Stats
$sql = "SELECT product.ref, COUNT(product.ref) as nb, SUM(tl.".$this->field_line.") as total, AVG(tl.".$this->field_line.") as avg";
$sql .= " FROM ".$this->from.", ".$this->from_line.", ".MAIN_DB_PREFIX."product as product";
if (empty($user->rights->societe->client->voir) && !$user->socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
$sql .= $this->join;
$sql .= " WHERE ".$this->where;

View File

@ -201,10 +201,10 @@ $arrayfields = array(
'c.multicurrency_total_ttc'=>array('label'=>'MulticurrencyAmountTTC', 'checked'=>0, 'enabled'=>(!isModEnabled("multicurrency") ? 0 : 1), 'position'=>110),
'u.login'=>array('label'=>"Author", 'checked'=>1, 'position'=>115),
'sale_representative'=>array('label'=>"SaleRepresentativesOfThirdParty", 'checked'=>0, 'position'=>116),
'total_pa' => array('label' => (getDolGlobalString('MARGIN_TYPE') == '1' ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (!isModEnabled('margin') || !$user->rights->margins->liretous ? 0 : 1)),
'total_margin' => array('label' => 'Margin', 'checked' => 0, 'position' => 301, 'enabled' => (!isModEnabled('margin') || !$user->rights->margins->liretous ? 0 : 1)),
'total_margin_rate' => array('label' => 'MarginRate', 'checked' => 0, 'position' => 302, 'enabled' => (!isModEnabled('margin') || !$user->rights->margins->liretous || empty($conf->global->DISPLAY_MARGIN_RATES) ? 0 : 1)),
'total_mark_rate' => array('label' => 'MarkRate', 'checked' => 0, 'position' => 303, 'enabled' => (!isModEnabled('margin') || !$user->rights->margins->liretous || empty($conf->global->DISPLAY_MARK_RATES) ? 0 : 1)),
'total_pa' => array('label' => (getDolGlobalString('MARGIN_TYPE') == '1' ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (!isModEnabled('margin') || !$user->hasRight("margins", "liretous") ? 0 : 1)),
'total_margin' => array('label' => 'Margin', 'checked' => 0, 'position' => 301, 'enabled' => (!isModEnabled('margin') || !$user->hasRight("margins", "liretous") ? 0 : 1)),
'total_margin_rate' => array('label' => 'MarginRate', 'checked' => 0, 'position' => 302, 'enabled' => (!isModEnabled('margin') || !$user->hasRight("margins", "liretous") || empty($conf->global->DISPLAY_MARGIN_RATES) ? 0 : 1)),
'total_mark_rate' => array('label' => 'MarkRate', 'checked' => 0, 'position' => 303, 'enabled' => (!isModEnabled('margin') || !$user->hasRight("margins", "liretous") || empty($conf->global->DISPLAY_MARK_RATES) ? 0 : 1)),
'c.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>120),
'c.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>125),
'c.date_cloture'=>array('label'=>"DateClosing", 'checked'=>0, 'position'=>130),
@ -298,19 +298,19 @@ if (empty($reshook)) {
// Mass actions
$objectclass = 'Commande';
$objectlabel = 'Orders';
$permissiontoread = $user->rights->commande->lire;
$permissiontoadd = $user->rights->commande->creer;
$permissiontodelete = $user->rights->commande->supprimer;
$permissiontoread = $user->hasRight("commande", "lire");
$permissiontoadd = $user->hasRight("commande", "creer");
$permissiontodelete = $user->hasRight("commande", "supprimer");
if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
$permissiontovalidate = $user->rights->commande->order_advance->validate;
$permissiontoclose = $user->rights->commande->order_advance->close;
$permissiontocancel = $user->rights->commande->order_advance->annuler;
$permissiontosendbymail = $user->rights->commande->order_advance->send;
$permissiontovalidate = $user->hasRight("commande", "order_advance", "validate");
$permissiontoclose = $user->hasRight("commande", "order_advance", "close");
$permissiontocancel = $user->hasRight("commande", "order_advance", "annuler");
$permissiontosendbymail = $user->hasRight("commande", "order_advance", "send");
} else {
$permissiontovalidate = $user->rights->commande->creer;
$permissiontoclose = $user->rights->commande->creer;
$permissiontocancel = $user->rights->commande->creer;
$permissiontosendbymail = $user->rights->commande->creer;
$permissiontovalidate = $user->hasRight("commande", "creer");
$permissiontoclose = $user->hasRight("commande", "creer");
$permissiontocancel = $user->hasRight("commande", "creer");
$permissiontosendbymail = $user->hasRight("commande", "creer");
}
$uploaddir = $conf->commande->multidir_output[$conf->entity];
$triggersendname = 'ORDER_SENTBYMAIL';
@ -789,6 +789,9 @@ $company_url_list = array();
$formcompany = new FormCompany($db);
$projectstatic = new Project($db);
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
$title = $langs->trans("Orders");
$help_url = "EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_Pedidos_de_clientes";
@ -935,11 +938,15 @@ if ($search_country) {
if ($search_type_thirdparty && $search_type_thirdparty != '-1') {
$sql .= " AND s.fk_typent IN (".$db->sanitize($search_type_thirdparty).')';
}
if ($search_company) {
$sql .= natural_search('s.nom', $search_company);
}
if ($search_company_alias) {
$sql .= natural_search('s.name_alias', $search_company_alias);
if (empty($arrayfields['s.name_alias']['checked']) && $search_company) {
$sql .= natural_search(array("s.nom", "s.name_alias"), $search_company);
} else {
if ($search_company) {
$sql .= natural_search('s.nom', $search_company);
}
if ($search_company_alias) {
$sql .= natural_search('s.name_alias', $search_company_alias);
}
}
if ($search_parent_name) {
$sql .= natural_search('s2.nom', $search_parent_name);
@ -1280,7 +1287,7 @@ if ($resql) {
if ($permissiontocancel) {
$arrayofmassactions['cancelorders'] = img_picto('', 'close_title', 'class="pictofixedwidth"').$langs->trans("Cancel");
}
if (isModEnabled('facture') && $user->rights->facture->creer) {
if (isModEnabled('facture') && $user->hasRight("facture", "creer")) {
$arrayofmassactions['createbills'] = img_picto('', 'bill', 'class="pictofixedwidth"').$langs->trans("CreateInvoiceForThisCustomer");
}
if ($permissiontoclose) {
@ -1387,7 +1394,7 @@ if ($resql) {
$moreforfilter = '';
// If the user can view prospects? sales other than his own
if ($user->rights->user->user->lire) {
if ($user->hasRight("user", "user", "lire")) {
$langs->load("commercial");
$moreforfilter .= '<div class="divsearchfield">';
$tmptitle = $langs->trans('ThirdPartiesOfSaleRepresentative');
@ -1395,7 +1402,7 @@ if ($resql) {
$moreforfilter .= '</div>';
}
// If the user can view other users
if ($user->rights->user->user->lire) {
if ($user->hasRight("user", "user", "lire")) {
$moreforfilter .= '<div class="divsearchfield">';
$tmptitle = $langs->trans('LinkedToSpecificUsers');
$moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->select_dolusers($search_user, 'search_user', $tmptitle, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth250 widthcentpercentminusx');
@ -1403,7 +1410,7 @@ if ($resql) {
}
// If the user can view other products/services than his own
if (isModEnabled('categorie') && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire)) {
if (isModEnabled('categorie') && $user->hasRight("categorie", "lire") && ($user->hasRight("produit", "lire") || $user->hasRight("service", "lire"))) {
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '<div class="divsearchfield">';
$tmptitle = $langs->trans('IncludingProductWithTag');
@ -1412,7 +1419,7 @@ if ($resql) {
$moreforfilter .= '</div>';
}
// If Categories are enabled & user has rights to see
if (isModEnabled('categorie') && $user->rights->categorie->lire) {
if (isModEnabled('categorie') && $user->hasRight("categorie", "lire")) {
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '<div class="divsearchfield">';
$tmptitle = $langs->trans('CustomersProspectsCategoriesShort');

View File

@ -488,7 +488,7 @@ if (!empty($arrayfields['b.clos']['checked'])) {
'opened'=>$langs->trans("Opened"),
'closed'=>$langs->trans("Closed")
);
print $form->selectarray("search_status", $array, $search_status, 1, 0, 0, '', 0, 0, 0, '', '', 1);
print $form->selectarray("search_status", $array, $search_status, 1, 0, 0, '', 0, 0, 0, '', 'search_status maxwidth125 onrightofpage', 1);
print '</td>';
}
// Balance

View File

@ -17,7 +17,7 @@
*/
/**
* \file cashcontrol_list.php
* \file htdocs/compta/cashcontrol/cashcontrol_list.php
* \ingroup cashdesk|takepos
* \brief List page for cashcontrol
*/
@ -50,8 +50,9 @@ $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) {
// If $page is not defined, or '' or -1 or if we click on clear filters
$page = 0;
} // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
}
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
@ -105,11 +106,11 @@ $arrayfields = array();
foreach ($object->fields as $key => $val) {
// If $val['visible']==0, then we never show the field
if (!empty($val['visible'])) {
$visible = (int) dol_eval($val['visible'], 1, 1, '1');
$visible = (int) dol_eval($val['visible'], 1);
$arrayfields['t.'.$key] = array(
'label'=>$val['label'],
'checked'=>(($visible < 0) ? 0 : 1),
'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1, 1, '1')),
'enabled'=>(abs($visible) != 3 && dol_eval($val['enabled'], 1)),
'position'=>$val['position'],
'help'=> isset($val['help']) ? $val['help'] : ''
);
@ -194,7 +195,8 @@ $now = dol_now();
//$help_url="EN:Module_pos_cash_fence|FR:Module_pos_cash_fence_FR|ES:Módulo_pos_cash_fence";
$help_url = '';
$title = $langs->trans('CashControl');
$morejs = array();
$morecss = array();
// Build and execute select
// --------------------------------------------------------------------
@ -211,6 +213,9 @@ $parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
$sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
$sql = preg_replace('/,\s*$/', '', $sql);
$sqlfields = $sql; // $sql fields to remove for count total
$sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
@ -237,17 +242,17 @@ foreach ($search as $key => $val) {
$mode_search = 2;
}
if ($search[$key] != '') {
$sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search));
$sql .= natural_search("t.".$db->escape($key), $search[$key], (($key == 'status') ? 2 : $mode_search));
}
} else {
if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') {
$columnName=preg_replace('/(_dtstart|_dtend)$/', '', $key);
if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) {
if (preg_match('/_dtstart$/', $key)) {
$sql .= " AND t." . $columnName . " >= '" . $db->idate($search[$key]) . "'";
$sql .= " AND t.".$db->escape($columnName)." >= '".$db->idate($search[$key])."'";
}
if (preg_match('/_dtend$/', $key)) {
$sql .= " AND t." . $columnName . " <= '" . $db->idate($search[$key]) . "'";
$sql .= " AND t.".$db->escape($columnName)." <= '".$db->idate($search[$key])."'";
}
}
}
@ -267,11 +272,13 @@ $sql .= $hookmanager->resPrint;
/* If a group by is required
$sql.= " GROUP BY ";
foreach($object->fields as $key => $val) {
$sql .= "t.".$key.", ";
$sql .= "t.".$db->escape($key).", ";
}
// Add fields from extrafields
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : '');
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : '');
}
}
// Add where from hooks
$parameters=array();
@ -280,35 +287,43 @@ $sql.=$hookmanager->resPrint;
$sql=preg_replace('/,\s*$/','', $sql);
*/
$sql .= $db->order($sortfield, $sortorder);
// Count total nb of records
$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
$resql = $db->query($sql);
$nbtotalofrecords = $db->num_rows($resql);
if (($page * $limit) > $nbtotalofrecords) { // if total of record found is smaller than page * limit, goto and load page 0
/* The fast and low memory method to get and count full list converts the sql into a sql count */
$sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
$sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
$resql = $db->query($sqlforcount);
if ($resql) {
$objforcount = $db->fetch_object($resql);
$nbtotalofrecords = $objforcount->nbtotalofrecords;
} else {
dol_print_error($db);
}
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
$page = 0;
$offset = 0;
}
$db->free($resql);
}
// if total of record found is smaller than limit, no need to do paging and to restart another select with limits set.
if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit))) {
$num = $nbtotalofrecords;
} else {
if ($limit) {
$sql .= $db->plimit($limit + 1, $offset);
}
$resql = $db->query($sql);
if (!$resql) {
dol_print_error($db);
exit;
}
$num = $db->num_rows($resql);
// Complete request and execute it with limit
$sql .= $db->order($sortfield, $sortorder);
if ($limit) {
$sql .= $db->plimit($limit + 1, $offset);
}
$resql = $db->query($sql);
if (!$resql) {
dol_print_error($db);
exit;
}
$num = $db->num_rows($resql);
// Direct jump if only one record found
if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) {
$obj = $db->fetch_object($resql);
@ -326,6 +341,9 @@ llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'classforhorizontalscroll
$arrayofselected = is_array($toselect) ? $toselect : array();
$param = '';
if (!empty($mode)) {
$param .= '&mode='.urlencode($mode);
}
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}
@ -333,11 +351,17 @@ if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
}
foreach ($search as $key => $val) {
if (is_array($search[$key]) && count($search[$key])) {
if (is_array($search[$key])) {
foreach ($search[$key] as $skey) {
$param .= '&search_'.$key.'[]='.urlencode($skey);
if ($skey != '') {
$param .= '&search_'.$key.'[]='.urlencode($skey);
}
}
} else {
} elseif (preg_match('/(_dtstart|_dtend)$/', $key) && !empty($val)) {
$param .= '&search_'.$key.'month='.((int) GETPOST('search_'.$key.'month', 'int'));
$param .= '&search_'.$key.'day='.((int) GETPOST('search_'.$key.'day', 'int'));
$param .= '&search_'.$key.'year='.((int) GETPOST('search_'.$key.'year', 'int'));
} elseif ($search[$key] != '') {
$param .= '&search_'.$key.'='.urlencode($search[$key]);
}
}
@ -373,6 +397,7 @@ print '<input type="hidden" name="formfilteraction" id="formfilteraction" value=
print '<input type="hidden" name="action" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
$permforcashfence = 1;
@ -389,10 +414,13 @@ $trackid = 'cashfence'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
if ($search_all) {
$setupstring = '';
foreach ($fieldstosearchall as $key => $val) {
$fieldstosearchall[$key] = $langs->trans($val);
$setupstring .= $key."=".$val.";";
}
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>';
print '<!-- Search done like if PRODUCT_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>'."\n";
}
$moreforfilter = '';
@ -433,13 +461,13 @@ foreach ($object->fields as $key => $val) {
$cssforfield .= ($cssforfield ? ' ' : '').'center';
} elseif (in_array($val['type'], array('timestamp'))) {
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'rowid' && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
$cssforfield .= ($cssforfield ? ' ' : '').'right';
}
if (!empty($arrayfields['t.'.$key]['checked'])) {
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100'.($key == 'status' ? ' search_status onrightofpage' : ''), 1);
} elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:')=== 0)) {
print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', 'maxwidth125', 1);
} elseif (!preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
@ -525,7 +553,8 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
$object->setVarsFromFetchObj($obj);
// Show here line of result
print '<tr class="oddeven">';
$j = 0;
print '<tr data-rowid="'.$object->id.'" class="oddeven">';
foreach ($object->fields as $key => $val) {
$cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
@ -546,7 +575,11 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
//if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100';
if (!empty($arrayfields['t.'.$key]['checked'])) {
print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '').'>';
print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '');
if (preg_match('/tdoverflow/', $cssforfield)) {
print ' title="'.dol_escape_htmltag($object->$key).'"';
}
print '>';
if ($key == 'status') {
print $object->getLibStatut(5);
} elseif ($key == 'rowid') {
@ -609,13 +642,13 @@ if ($num == 0) {
$colspan++;
}
}
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
}
$db->free($resql);
$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '</table>'."\n";

View File

@ -142,7 +142,7 @@ if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massa
$massaction = '';
}
$parameters = array('socid' => $socid);
$parameters = array();
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
@ -800,8 +800,10 @@ if (empty($reshook)) {
$label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : '');
$typeinvoice = Facture::TYPE_STANDARD;
// Check price is not lower than minimum (check is done only for standard or replacement invoices)
if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)) && (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT) && $price_min && (price2num($pu_ht) * (1 - $remise_percent / 100) < price2num($price_min)))) {
if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)) && (($typeinvoice == Facture::TYPE_STANDARD || $typeinvoice == Facture::TYPE_REPLACEMENT) && $price_min && ((float) price2num($pu_ht) * (1 - (float) $remise_percent / 100) < (float) price2num($price_min)))) {
setEventMessages($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), null, 'errors');
$error++;
}

View File

@ -3066,6 +3066,11 @@ if ($action == 'create') {
$remise_percent = (!empty($expesrc->remise_percent) ? $expesrc->remise_percent : (!empty($soc->remise_percent) ? $soc->remise_percent : 0));
$remise_absolue = (!empty($expesrc->remise_absolue) ? $expesrc->remise_absolue : (!empty($soc->remise_absolue) ? $soc->remise_absolue : 0));
if (!empty($conf->multicurrency->enabled)) {
$currency_code = (!empty($expesrc->currency_code) ? $expesrc->currency_code : (!empty($soc->currency_code) ? $soc->currency_code : $objectsrc->multicurrency_code));
$currency_tx = (!empty($expesrc->currency_tx) ? $expesrc->currency_tx : (!empty($soc->currency_tx) ? $soc->currency_tx : $objectsrc->currency_tx));
}
//Replicate extrafields
$expesrc->fetch_optionals();
$object->array_options = $expesrc->array_options;

View File

@ -376,9 +376,9 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter',
if (empty($reshook)) {
$objectclass = 'Facture';
$objectlabel = 'Invoices';
$permissiontoread = $user->rights->facture->lire;
$permissiontoadd = $user->rights->facture->creer;
$permissiontodelete = $user->rights->facture->supprimer;
$permissiontoread = $user->hasRight("facture", "lire");
$permissiontoadd = $user->hasRight("facture", "creer");
$permissiontodelete = $user->hasRight("facture", "supprimer");
$uploaddir = $conf->facture->dir_output;
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
}
@ -558,6 +558,9 @@ $companystatic = new Societe($db);
$companyparent = new Societe($db);
$company_url_list = array();
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
$sql = 'SELECT';
if ($sall || $search_user > 0) {
$sql = 'SELECT DISTINCT';
@ -670,11 +673,15 @@ if ($search_project_ref) {
if ($search_project) {
$sql .= natural_search('p.title', $search_project);
}
if ($search_company) {
$sql .= natural_search('s.nom', $search_company);
}
if ($search_company_alias) {
$sql .= natural_search('s.name_alias', $search_company_alias);
if (empty($arrayfields['s.name_alias']['checked']) && $search_company) {
$sql .= natural_search(array("s.nom", "s.name_alias"), $search_company);
} else {
if ($search_company) {
$sql .= natural_search('s.nom', $search_company);
}
if ($search_company_alias) {
$sql .= natural_search('s.name_alias', $search_company_alias);
}
}
if ($search_parent_name) {
$sql .= natural_search('s2.nom', $search_parent_name);
@ -1178,7 +1185,7 @@ if ($resql) {
if (!empty($socid)) {
$url .= '&socid='.$socid;
}
$newcardbutton = dolGetButtonTitle($langs->trans('NewBill'), '', 'fa fa-plus-circle', $url, '', $user->rights->facture->creer);
$newcardbutton = dolGetButtonTitle($langs->trans('NewBill'), '', 'fa fa-plus-circle', $url, '', $user->hasRight("facture", "creer"));
}
$i = 0;
@ -1230,7 +1237,7 @@ if ($resql) {
// If the user can view prospects other than his'
$moreforfilter = '';
if ($user->rights->user->user->lire) {
if ($user->hasRight("user", "user", "lire")) {
$langs->load("commercial");
$moreforfilter .= '<div class="divsearchfield">';
$tmptitle = $langs->trans('ThirdPartiesOfSaleRepresentative');
@ -1238,14 +1245,14 @@ if ($resql) {
$moreforfilter .= '</div>';
}
// If the user can view prospects other than his'
if ($user->rights->user->user->lire) {
if ($user->hasRight("user", "user", "lire")) {
$moreforfilter .= '<div class="divsearchfield">';
$tmptitle = $langs->trans('LinkedToSpecificUsers');
$moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->select_dolusers($search_user, 'search_user', $tmptitle, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth250');
$moreforfilter .= '</div>';
}
// Filter on product tags
if (isModEnabled('categorie') && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire)) {
if (isModEnabled('categorie') && $user->hasRight("categorie", "lire") && ($user->hasRight("produit", "lire") || $user->hasRight("service", "lire"))) {
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '<div class="divsearchfield">';
$tmptitle = $langs->trans('IncludingProductWithTag');
@ -1253,7 +1260,7 @@ if ($resql) {
$moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$form->selectarray('search_product_category', $cate_arbo, $search_product_category, $tmptitle, 0, 0, '', 0, 0, 0, 0, 'maxwidth250', 1);
$moreforfilter .= '</div>';
}
if (isModEnabled('categorie') && $user->rights->categorie->lire) {
if (isModEnabled('categorie') && $user->hasRight("categorie", "lire")) {
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '<div class="divsearchfield">';
$tmptitle = $langs->trans('CustomersProspectsCategoriesShort');
@ -1772,6 +1779,7 @@ if ($resql) {
$totalarray = array();
$totalarray['nbfield'] = 0;
$totalarray['val'] = array();
$totalarray['val']['f.total_tva'] = 0;
$totalarray['val']['f.total_ht'] = 0;
$totalarray['val']['f.total_ttc'] = 0;
@ -2566,8 +2574,8 @@ if ($resql) {
$urlsource .= str_replace('&amp;', '&', $param);
$filedir = $diroutputmassaction;
$genallowed = $user->rights->facture->lire;
$delallowed = $user->rights->facture->creer;
$genallowed = $user->hasRight("facture", "lire");
$delallowed = $user->hasRight("facture", "creer");
$title = '';
print $formfile->showdocuments('massfilesarea_invoices', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);

View File

@ -281,7 +281,7 @@ if (isModEnabled('facture') && !empty($user->rights->facture->lire)) {
// Last modified supplier invoices
if ((isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->facture->lire) || (isModEnabled('supplier_invoice') && $user->rights->supplier_invoice->lire)) {
if ((isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire")) || (isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) {
$langs->load("boxes");
$facstatic = new FactureFournisseur($db);
@ -590,7 +590,7 @@ if (isModEnabled('tax') && !empty($user->rights->tax->charges->lire)) {
/*
* Customers orders to be billed
*/
if (isModEnabled('facture') && isModEnabled('commande') && $user->rights->commande->lire && empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) {
if (isModEnabled('facture') && isModEnabled('commande') && $user->hasRight("commande", "lire") && empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) {
$commandestatic = new Commande($db);
$langs->load("orders");

View File

@ -385,14 +385,15 @@ if ($action == 'new') {
print dol_get_fiche_end();
print '<div class="center">';
print '<input type="submit" class="button" name="filter" value="'.dol_escape_htmltag($langs->trans("ToFilter")).'">';
print '<input type="submit" class="button small" name="filter" value="'.dol_escape_htmltag($langs->trans("ToFilter")).'">';
if ($search_date_start || $search_date_end || $filteraccountid > 0) {
print ' &nbsp; ';
print '<input type="submit" class="button" name="removefilter" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print '<input type="submit" class="button" name="removefilter small" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
}
print '</div>';
print '</form>';
print '<br>';
print '<br>';
$sql = "SELECT ba.rowid as bid, ba.label,";
$sql .= " b.rowid as transactionid, b.label as transactionlabel, b.datec as datec, b.dateo as date, ";

View File

@ -32,15 +32,23 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
// Load translation files required by the page
$langs->loadLangs(array('banks', 'categories', 'compta', 'bills'));
$checkdepositstatic = new RemiseCheque($db);
$accountstatic = new Account($db);
// Security check
if ($user->socid) {
$socid = $user->socid;
}
$result = restrictedArea($user, 'banque', '', '');
$usercancreate = $user->hasRight('banque', 'cheque');
$checkdepositstatic = new RemiseCheque($db);
$accountstatic = new Account($db);
/*
* Actions
*/
// None
/*
@ -49,11 +57,16 @@ $accountstatic = new Account($db);
llxHeader('', $langs->trans("ChequesArea"));
print load_fiche_titre($langs->trans("ChequesArea"), '', $checkdepositstatic->picto);
$newcardbutton = '';
if ($usercancreate) {
$newcardbutton .= dolGetButtonTitle($langs->trans('NewDeposit'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/paiement/cheque/card.php?action=new');
}
print load_fiche_titre($langs->trans("ChequesArea"), $newcardbutton, $checkdepositstatic->picto);
print '<div class="fichecenter"><div class="fichethirdleft">';
$sql = "SELECT count(b.rowid)";
$sql = "SELECT count(b.rowid) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
$sql .= ", ".MAIN_DB_PREFIX."bank_account as ba";
$sql .= " WHERE ba.rowid = b.fk_account";
@ -64,24 +77,26 @@ $sql .= " AND b.amount > 0";
$resql = $db->query($sql);
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<th colspan="2">'.$langs->trans("BankChecks")."</th>\n";
print "</tr>\n";
if ($resql) {
if ($row = $db->fetch_row($resql)) {
$num = $row[0];
$num = '';
if ($obj = $db->fetch_object($resql)) {
$num = $obj->nb;
}
print '<tr class="oddeven">';
print '<td>'.$langs->trans("BankChecksToReceipt").'</td>';
print '<td class="right">';
print '<a href="'.DOL_URL_ROOT.'/compta/paiement/cheque/card.php?leftmenu=customers_bills_checks&action=new">'.$num.'</a>';
print '<a class="badge badge-info" href="'.DOL_URL_ROOT.'/compta/paiement/cheque/card.php?leftmenu=customers_bills_checks&action=new">'.$num.'</a>';
print '</td></tr>';
print "</table>\n";
} else {
dol_print_error($db);
}
print "</table></div>\n";
print '</div><div class="fichetwothirdright">';

View File

@ -86,7 +86,7 @@ print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Statistics").'</
print '<tr class="oddeven"><td>'.$langs->trans("NbOfInvoiceToPayByBankTransfer").'</td>';
print '<td class="right">';
print '<a href="'.DOL_URL_ROOT.'/compta/prelevement/demandes.php?status=0&type=bank-transfer">';
print '<a class="badge badge-info" href="'.DOL_URL_ROOT.'/compta/prelevement/demandes.php?status=0&type=bank-transfer">';
print $bprev->nbOfInvoiceToPay('bank-transfer');
print '</a>';
print '</td></tr>';
@ -183,7 +183,8 @@ if ($resql) {
$i++;
}
} else {
print '<tr class="oddeven"><td colspan="5"><span class="opacitymedium">'.$langs->trans("NoSupplierInvoiceToWithdraw", $langs->transnoentitiesnoconv("BankTransfer")).'</span></td></tr>';
$titlefortab = $langs->transnoentitiesnoconv("BankTransfer");
print '<tr class="oddeven"><td colspan="5"><span class="opacitymedium">'.$langs->trans("NoSupplierInvoiceToWithdraw", $titlefortab, $titlefortab).'</span></td></tr>';
}
print "</table></div><br>";
} else {

View File

@ -86,7 +86,7 @@ print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Statistics").'</
print '<tr class="oddeven"><td>'.$langs->trans("NbOfInvoiceToWithdraw").'</td>';
print '<td class="right">';
print '<a href="'.DOL_URL_ROOT.'/compta/prelevement/demandes.php?status=0">';
print '<a class="badge badge-info" href="'.DOL_URL_ROOT.'/compta/prelevement/demandes.php?status=0">';
print $bprev->nbOfInvoiceToPay('direct-debit');
print '</a>';
print '</td></tr>';
@ -184,7 +184,7 @@ if ($resql) {
}
} else {
$titlefortab = $langs->transnoentitiesnoconv("StandingOrders");
print '<tr class="oddeven"><td colspan="5" class="opacitymedium">'.$langs->trans("NoInvoiceToWithdraw", $titlefortab, $titlefortab).'</td></tr>';
print '<tr class="oddeven"><td colspan="5"><span class="opacitymedium">'.$langs->trans("NoInvoiceToWithdraw", $titlefortab, $titlefortab).'</span></td></tr>';
}
print "</table></div><br>";
} else {

View File

@ -321,7 +321,7 @@ if ($modecompta == 'BOOKKEEPING') {
if ($showaccountdetail == 'no') {
if ($objp->pcg_type != $oldpcgtype) {
print '<tr class="trforbreak"><td colspan="3" class="tdforbreak">'.$objp->pcg_type.'</td></tr>';
print '<tr class="trforbreak"><td colspan="3" class="tdforbreak">'.dol_escape_htmltag($objp->pcg_type).'</td></tr>';
$oldpcgtype = $objp->pcg_type;
}
}
@ -330,17 +330,17 @@ if ($modecompta == 'BOOKKEEPING') {
print '<tr class="oddeven">';
print '<td></td>';
print '<td>';
print $objp->pcg_type;
print ($objp->name ? ' ('.$objp->name.')' : ' ('.$langs->trans("Unknown").')');
print dol_escape_htmltag($objp->pcg_type);
print ($objp->name ? ' ('.dol_escape_htmltag($objp->name).')' : ' ('.$langs->trans("Unknown").')');
print "</td>\n";
print '<td class="right"><span class="amount">'.price($objp->amount)."</span></td>\n";
print '<td class="right nowraponall"><span class="amount">'.price($objp->amount)."</span></td>\n";
print "</tr>\n";
} else {
print '<tr class="oddeven trforbreak">';
print '<td colspan="2" class="tdforbreak">';
print $objp->pcg_type;
print dol_escape_htmltag($objp->pcg_type);
print "</td>\n";
print '<td class="right tdforbreak"><span class="amount">'.price($objp->amount)."</span></td>\n";
print '<td class="right nowraponall tdforbreak"><span class="amount">'.price($objp->amount)."</span></td>\n";
print "</tr>\n";
}
@ -380,7 +380,7 @@ if ($modecompta == 'BOOKKEEPING') {
print '<tr>';
print '<td></td>';
print '<td class="tdoverflowmax200"> &nbsp; &nbsp; '.length_accountg($cpt['account_number']).' - '.$cpt['account_label'].'</td>';
print '<td class="right"><span class="amount">'.price($resultN).'</span></td>';
print '<td class="right nowraponall"><span class="amount">'.price($resultN).'</span></td>';
print "</tr>\n";
}
}
@ -1539,27 +1539,27 @@ print '</tr>';
print '<tr class="liste_total"><td class="left" colspan="2">'.$langs->trans("Income").'</td>';
if ($modecompta == 'CREANCES-DETTES') {
print '<td class="liste_total right">'.price(price2num($total_ht_income, 'MT')).'</td>';
print '<td class="liste_total right nowraponall">'.price(price2num($total_ht_income, 'MT')).'</td>';
} elseif ($modecompta == 'RECETTES-DEPENSES') {
print '<td></td>';
}
print '<td class="liste_total right">'.price(price2num($total_ttc_income, 'MT')).'</td>';
print '<td class="liste_total right nowraponall">'.price(price2num($total_ttc_income, 'MT')).'</td>';
print '</tr>';
print '<tr class="liste_total"><td class="left" colspan="2">'.$langs->trans("Outcome").'</td>';
if ($modecompta == 'CREANCES-DETTES') {
print '<td class="liste_total right">'.price(price2num(-$total_ht_outcome, 'MT')).'</td>';
print '<td class="liste_total right nowraponall">'.price(price2num(-$total_ht_outcome, 'MT')).'</td>';
} elseif ($modecompta == 'RECETTES-DEPENSES') {
print '<td></td>';
}
print '<td class="liste_total right">'.price(price2num(-$total_ttc_outcome, 'MT')).'</td>';
print '<td class="liste_total right nowraponall">'.price(price2num(-$total_ttc_outcome, 'MT')).'</td>';
print '</tr>';
print '<tr class="liste_total"><td class="left" colspan="2">'.$langs->trans("Profit").'</td>';
if ($modecompta == 'CREANCES-DETTES') {
print '<td class="liste_total right">'.price(price2num($total_ht, 'MT')).'</td>';
print '<td class="liste_total right nowraponall">'.price(price2num($total_ht, 'MT')).'</td>';
} elseif ($modecompta == 'RECETTES-DEPENSES') {
print '<td></td>';
}
print '<td class="liste_total right">'.price(price2num($total_ttc, 'MT')).'</td>';
print '<td class="liste_total right nowraponall">'.price(price2num($total_ttc, 'MT')).'</td>';
print '</tr>';
print "</table>";

View File

@ -295,11 +295,13 @@ if ($result) {
$num = $db->num_rows($result);
$i = 0;
while ($i < $num) {
$obj = $db->fetch_object($result);
$amount_ht[$obj->rowid] = $obj->amount;
$obj = $db->fetch_object($result);
$amount_ht[$obj->rowid] = (empty($obj->amount) ? 0 : $obj->amount);
$amount[$obj->rowid] = $obj->amount_ttc;
$name[$obj->rowid] = $obj->name.' '.$obj->firstname;
$catotal_ht += $obj->amount;
$catotal_ht += (empty($obj->amount) ? 0 : $obj->amount);
$catotal += $obj->amount_ttc;
$i++;
}

View File

@ -360,19 +360,23 @@ if ($result) {
$i = 0;
while ($i < $num) {
$obj = $db->fetch_object($result);
$amount_ht[$obj->socid] = $obj->amount;
$amount[$obj->socid] = $obj->amount_ttc;
$fullname = $obj->name;
$amount_ht[$obj->socid] = (empty($obj->amount) ? 0 : $obj->amount);
$amount[$obj->socid] = $obj->amount_ttc;
$fullname = $obj->name;
if (!empty($obj->name_alias)) {
$fullname .= ' ('.$obj->name_alias.')';
}
$name[$obj->socid] = $fullname;
$address_zip[$obj->socid] = $obj->zip;
$address_town[$obj->socid] = $obj->town;
$address_pays[$obj->socid] = getCountry($obj->fk_pays);
$catotal_ht += $obj->amount;
$catotal += $obj->amount_ttc;
$i++;
$name[$obj->socid] = $fullname;
$address_zip[$obj->socid] = $obj->zip;
$address_town[$obj->socid] = $obj->town;
$address_pays[$obj->socid] = getCountry($obj->fk_pays);
$catotal_ht += (empty($obj->amount) ? 0 : $obj->amount);
$catotal += $obj->amount_ttc;
$i++;
}
} else {
dol_print_error($db);
@ -401,12 +405,16 @@ if ($modecompta == "RECETTES-DEPENSES") {
$i = 0;
while ($i < $num) {
$obj = $db->fetch_object($result);
$amount[$obj->rowid] += $obj->amount_ttc;
$name[$obj->rowid] = $obj->name;
$address_zip[$obj->rowid] = $obj->zip;
$address_town[$obj->rowid] = $obj->town;
$address_pays[$obj->rowid] = getCountry($obj->fk_pays);
$catotal += $obj->amount_ttc;
$i++;
}
} else {

View File

@ -431,7 +431,7 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) {
// Value turnover of month
print '<td class="right">';
if ($annee < $year_end || ($annee == $year_end && $mois <= $month_end)) {
if ($cum[$case]) {
if (!empty($cum[$case])) {
$now_show_delta = 1; // On a trouve le premier mois de la premiere annee generant du chiffre.
if ($modecompta != 'BOOKKEEPING') {
print '<a href="casoc.php?year='.$annee_decalage.'&month='.$mois_modulo.($modecompta ? '&modecompta='.$modecompta : '').'">';
@ -455,22 +455,22 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) {
//var_dump($annee.' '.$year_end.' '.$mois.' '.$month_end);
if ($annee < $year_end || ($annee == $year_end && $mois <= $month_end)) {
if ($annee_decalage > $minyear && $case <= $casenow) {
if ($cum[$caseprev] && $cum[$case]) {
if (!empty($cum[$caseprev]) && !empty($cum[$case])) {
$percent = (round(($cum[$case] - $cum[$caseprev]) / $cum[$caseprev], 4) * 100);
//print "X $cum[$case] - $cum[$caseprev] - $cum[$caseprev] - $percent X";
print ($percent >= 0 ? "+$percent" : "$percent").'%';
}
if ($cum[$caseprev] && !$cum[$case]) {
if (!empty($cum[$caseprev]) && empty($cum[$case])) {
print '-100%';
}
if (!$cum[$caseprev] && $cum[$case]) {
if (empty($cum[$caseprev]) && !empty($cum[$case])) {
//print '<td class="right">+Inf%</td>';
print '-';
}
if (isset($cum[$caseprev]) && !$cum[$caseprev] && !$cum[$case]) {
if (isset($cum[$caseprev]) && empty($cum[$caseprev]) && empty($cum[$case])) {
print '+0%';
}
if (!isset($cum[$caseprev]) && !$cum[$case]) {
if (!isset($cum[$caseprev]) && empty($cum[$case])) {
print '-';
}
} else {
@ -489,8 +489,16 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) {
}
if ($annee < $year_end || ($annee == $year_end && $mois <= $month_end)) {
$total_ht[$annee] += ((!empty($cum_ht[$case])) ? $cum_ht[$case] : 0);
$total[$annee] += $cum[$case];
if (empty($total_ht[$annee])) {
$total_ht[$annee] = (empty($cum_ht[$case]) ? 0 : $cum_ht[$case]);
} else {
$total_ht[$annee] += (empty($cum_ht[$case]) ? 0 : $cum_ht[$case]);
}
if (empty($total[$annee])) {
$total[$annee] = empty($cum[$case]) ? 0 : $cum[$case];
} else {
$total[$annee] += empty($cum[$case]) ? 0 : $cum[$case];
}
}
}
@ -577,7 +585,7 @@ for ($annee = $year_start; $annee <= $year_end; $annee++) {
}
// Total amount
if ($total[$annee] || ($annee >= $minyear && $annee <= max($nowyear, $maxyear))) {
if (!empty($total[$annee]) || ($annee >= $minyear && $annee <= max($nowyear, $maxyear))) {
print '<td class="nowrap right">';
print ($total[$annee] ?price($total[$annee]) : "0");
print "</td>";
@ -604,7 +612,7 @@ for ($annee = $year_start; $annee <= $year_end; $annee++) {
}
} else {
print '<td class="borderrightlight right">';
if ($total[$annee] || ($minyear <= $annee && $annee <= max($nowyear, $maxyear))) {
if (!empty($total[$annee]) || ($minyear <= $annee && $annee <= max($nowyear, $maxyear))) {
print '-';
} else {
print '&nbsp;';

View File

@ -186,7 +186,10 @@ $moreparam = array();
if (!empty($modecompta)) {
$moreparam['modecompta'] = $modecompta;
}
report_header($name, $namelink, $period, $periodlink, $description, $builddate, $exportlink, $moreparam, $calcmode);
$exportlink = '';
report_header($name, '', $period, $periodlink, $description, $builddate, $exportlink, $moreparam, $calcmode);
if (isModEnabled('accounting') && $modecompta != 'BOOKKEEPING') {
print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1);
@ -347,7 +350,7 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) {
if ($modecompta == 'CREANCES-DETTES') {
// Valeur CA du mois w/o VAT
print '<td class="right">';
if ($cum_ht[$case]) {
if (!empty($cum_ht[$case])) {
$now_show_delta = 1; // On a trouve le premier mois de la premiere annee generant du chiffre.
print '<a href="supplier_turnover_by_thirdparty.php?year='.$annee_decalage.'&month='.$mois_modulo.($modecompta ? '&modecompta='.$modecompta : '').'">'.price($cum_ht[$case], 1).'</a>';
} else {
@ -362,7 +365,7 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) {
// Valeur CA du mois
print '<td class="right">';
if ($cum[$case]) {
if (!empty($cum[$case])) {
$now_show_delta = 1; // On a trouve le premier mois de la premiere annee generant du chiffre.
if ($modecompta != 'BOOKKEEPING') {
print '<a href="supplier_turnover_by_thirdparty.php?year='.$annee_decalage.'&month='.$mois_modulo.($modecompta ? '&modecompta='.$modecompta : '').'">';
@ -382,22 +385,22 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) {
// Pourcentage du mois
if ($annee_decalage > $minyear && $case <= $casenow) {
if ($cum[$caseprev] && $cum[$case]) {
if (!empty($cum[$caseprev]) && !empty($cum[$case])) {
$percent = (round(($cum[$case] - $cum[$caseprev]) / $cum[$caseprev], 4) * 100);
//print "X $cum[$case] - $cum[$caseprev] - $cum[$caseprev] - $percent X";
print '<td class="borderrightlight right">'.($percent >= 0 ? "+$percent" : "$percent").'%</td>';
}
if ($cum[$caseprev] && !$cum[$case]) {
if (!empty($cum[$caseprev]) && empty($cum[$case])) {
print '<td class="borderrightlight right">-100%</td>';
}
if (!$cum[$caseprev] && $cum[$case]) {
if (empty($cum[$caseprev]) && !empty($cum[$case])) {
//print '<td class="right">+Inf%</td>';
print '<td class="borderrightlight right">-</td>';
}
if (isset($cum[$caseprev]) && !$cum[$caseprev] && !$cum[$case]) {
if (isset($cum[$caseprev]) && empty($cum[$caseprev]) && empty($cum[$case])) {
print '<td class="borderrightlight right">+0%</td>';
}
if (!isset($cum[$caseprev]) && !$cum[$case]) {
if (!isset($cum[$caseprev]) && empty($cum[$case])) {
print '<td class="borderrightlight right">-</td>';
}
} else {
@ -415,8 +418,16 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) {
}
}
$total_ht[$annee] += ((!empty($cum_ht[$case])) ? $cum_ht[$case] : 0);
$total[$annee] += $cum[$case];
if (empty($total_ht[$annee])) {
$total_ht[$annee] = ((!empty($cum_ht[$case])) ? $cum_ht[$case] : 0);
} else {
$total_ht[$annee] += ((!empty($cum_ht[$case])) ? $cum_ht[$case] : 0);
}
if (empty($total[$annee])) {
$total[$annee] = (empty($cum[$case]) ? 0 : $cum[$case]);
} else {
$total[$annee] += (empty($cum[$case]) ? 0 : $cum[$case]);
}
}
print '</tr>';

View File

@ -188,6 +188,7 @@ $allparams = array_merge($commonparams, $headerparams, $tableparams);
$headerparams = array_merge($commonparams, $headerparams);
$tableparams = array_merge($commonparams, $tableparams);
$paramslink = '';
foreach ($allparams as $key => $value) {
$paramslink .= '&'.$key.'='.$value;
}
@ -251,7 +252,9 @@ if ($date_end == dol_time_plus_duree($date_start, 1, 'y') - 1) {
$periodlink = '';
}
report_header($name, $namelink, $period, $periodlink, $description, $builddate, $exportlink, $tableparams, $calcmode);
$exportlink = '';
report_header($name, '', $period, $periodlink, $description, $builddate, $exportlink, $tableparams, $calcmode);
if (isModEnabled('accounting') && $modecompta != 'BOOKKEEPING') {
print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1);
@ -309,20 +312,23 @@ if ($modecompta == 'CREANCES-DETTES') {
$sql .= $db->order($sortfield, $sortorder);
dol_syslog("supplier_turnover_by_prodserv", LOG_DEBUG);
$result = $db->query($sql);
if ($result) {
$num = $db->num_rows($result);
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
$i = 0;
while ($i < $num) {
$obj = $db->fetch_object($result);
$obj = $db->fetch_object($resql);
$amount_ht[$obj->rowid] = $obj->amount;
$amount[$obj->rowid] = $obj->amount_ttc;
$qty[$obj->rowid] = $obj->qty;
$name[$obj->rowid] = $obj->ref.'&nbsp;-&nbsp;'.$obj->label;
$type[$obj->rowid] = $obj->product_type;
$catotal_ht += $obj->amount;
$catotal += $obj->amount_ttc;
$qtytotal += $obj->qty;
$i++;
}
} else {
@ -407,7 +413,7 @@ if ($modecompta == 'CREANCES-DETTES') {
$_SERVER["PHP_SELF"],
"amount",
"",
$classslink,
$paramslink,
'class="right"',
$sortfield,
$sortorder

View File

@ -153,7 +153,6 @@ $headerparams['date_startday'] = $date_startday;
$headerparams['date_endyear'] = $date_endyear;
$headerparams['date_endmonth'] = $date_endmonth;
$headerparams['date_endday'] = $date_endday;
$headerparams['q'] = $q;
$tableparams = array();
$tableparams['search_categ'] = $selected_cat;
@ -168,6 +167,7 @@ $allparams = array_merge($commonparams, $headerparams, $tableparams);
$headerparams = array_merge($commonparams, $headerparams);
$tableparams = array_merge($commonparams, $tableparams);
$paramslink = '';
foreach ($allparams as $key => $value) {
$paramslink .= '&'.$key.'='.$value;
}
@ -230,6 +230,8 @@ if ($date_end == dol_time_plus_duree($date_start, 1, 'y') - 1) {
$periodlink = '';
}
$exportlink = '';
report_header($name, '', $period, $periodlink, $description, $builddate, $exportlink, $tableparams, $calcmode);
if (isModEnabled('accounting') && $modecompta != 'BOOKKEEPING') {
@ -315,22 +317,29 @@ $sql .= " GROUP BY s.rowid, s.nom, s.zip, s.town, s.fk_pays";
$sql .= " ORDER BY s.rowid";
//echo $sql;
$catotal_ht = 0;
$catotal = 0;
dol_syslog("supplier_turnover_by_thirdparty", LOG_DEBUG);
$result = $db->query($sql);
if ($result) {
$num = $db->num_rows($result);
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
$i = 0;
while ($i < $num) {
$obj = $db->fetch_object($result);
$amount_ht[$obj->socid] = $obj->amount;
$amount[$obj->socid] = $obj->amount_ttc;
$name[$obj->socid] = $obj->name.' '.$obj->firstname;
$address_zip[$obj->socid] = $obj->zip;
$address_town[$obj->socid] = $obj->town;
$address_pays[$obj->socid] = getCountry($obj->fk_pays);
$catotal_ht += $obj->amount;
$catotal += $obj->amount_ttc;
$i++;
$obj = $db->fetch_object($resql);
$amount_ht[$obj->socid] = (empty($obj->amount) ? 0 : $obj->amount);
$amount[$obj->socid] = $obj->amount_ttc;
//$name[$obj->socid] = $obj->name.' '.$obj->firstname;
$address_zip[$obj->socid] = $obj->zip;
$address_town[$obj->socid] = $obj->town;
$address_pays[$obj->socid] = getCountry($obj->fk_pays);
$catotal_ht += (empty($obj->amount) ? 0 : $obj->amount);
$catotal += $obj->amount_ttc;
$i++;
}
} else {
dol_print_error($db);

View File

@ -669,6 +669,7 @@ if (empty($reshook)) {
}
} elseif ($action == 'updateline' && $user->rights->contrat->creer && !GETPOST('cancel', 'alpha')) {
$error = 0;
$predef = '';
if (!empty($date_start_update) && !empty($date_end_update) && $date_start_update > $date_end_update) {
setEventMessages($langs->trans("Error").': '.$langs->trans("DateStartPlanned").' > '.$langs->trans("DateEndPlanned"), null, 'errors');
@ -744,7 +745,7 @@ if (empty($reshook)) {
$objectline->date_end = $date_end_update;
$objectline->date_end_real = $date_end_real_update;
$objectline->fk_user_cloture = $user->id;
$objectline->fk_fournprice = $fk_fournprice;
//$objectline->fk_fournprice = $fk_fournprice;
$objectline->pa_ht = $pa_ht;
$objectline->rang = $objectline->rang;
@ -1634,9 +1635,9 @@ if ($action == 'create') {
if ($objp->subprice >= 0) {
$colspan = 6;
if ($conf->margin->enabled && $conf->global->PRODUCT_USE_UNITS) {
if ($conf->margin->enabled && getDolGlobalString('PRODUCT_USE_UNITS')) {
$colspan = 8;
} elseif ($conf->margin->enabled || $conf->global->PRODUCT_USE_UNITS) {
} elseif ($conf->margin->enabled || getDolGlobalString('PRODUCT_USE_UNITS')) {
$colspan = 7;
}
@ -2204,7 +2205,7 @@ if ($action == 'create') {
$delallowed = $user->rights->contrat->creer;
print $formfile->showdocuments('contract', $filename, $filedir, $urlsource, $genallowed, $delallowed, ($object->model_pdf ? $object->model_pdf : $conf->global->CONTRACT_ADDON_PDF), 1, 0, 0, 28, 0, '', 0, '', $soc->default_lang, '', $object);
print $formfile->showdocuments('contract', $filename, $filedir, $urlsource, $genallowed, $delallowed, ($object->model_pdf ? $object->model_pdf : getDolGlobalString('CONTRACT_ADDON_PDF')), 1, 0, 0, 28, 0, '', 0, '', $soc->default_lang, '', $object);
// Show links to link elements
@ -2212,7 +2213,7 @@ if ($action == 'create') {
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
// Show online signature link
if ($object->statut != Contrat::STATUS_DRAFT && $conf->global->CONTRACT_ALLOW_ONLINESIGN) {
if ($object->statut != Contrat::STATUS_DRAFT && getDolGlobalString('CONTRACT_ALLOW_ONLINESIGN')) {
print '<br><!-- Link to sign -->';
require_once DOL_DOCUMENT_ROOT.'/core/lib/signature.lib.php';

View File

@ -718,7 +718,7 @@ class Contrat extends CommonObject
$this->socid = $obj->fk_soc;
$this->fk_soc = $obj->fk_soc;
$this->last_main_doc = $obj->last_main_doc;
$this->extraparams = (array) json_decode($obj->extraparams, true);
$this->extraparams = (isset($obj->extraparams) ? (array) json_decode($obj->extraparams, true) : null);
$this->db->free($resql);
@ -2865,23 +2865,6 @@ class ContratLigne extends CommonObjectLine
public $date_start_real; // date start real
public $date_end; // date end planned
public $date_end_real; // date end real
// For backward compatibility
/**
* @deprecated Use date_start
*/
//public $date_ouverture_prevue; // date start planned
/**
* @deprecated Use date_start_real
*/
//public $date_ouverture; // date start real
/**
* @deprecated Use date_end
*/
//public $date_fin_validite; // date end planned
/**
* @deprecated Use date_end_real
*/
//public $date_cloture; // date end real
public $tva_tx;
public $vat_src_code;
@ -3303,15 +3286,11 @@ class ContratLigne extends CommonObjectLine
$this->date_end_real = $this->date_end_real;
}
// Check parameters
// Put here code to add control on parameters values
// Calcul du total TTC et de la TVA pour la ligne a partir de
// qty, pu, remise_percent et txtva
// TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker
// la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva.
$localtaxes_type = getLocalTaxesFromRate($this->txtva, 0, $this->societe, $mysoc);
$localtaxes_type = getLocalTaxesFromRate($this->txtva, 0, $this->thirdparty, $mysoc);
$tabprice = calcul_price_total($this->qty, $this->price_ht, $this->remise_percent, $this->tva_tx, $this->localtax1_tx, $this->localtax2_tx, 0, 'HT', 0, 1, $mysoc, $localtaxes_type);
$this->total_ht = $tabprice[0];
@ -3645,6 +3624,7 @@ class ContratLigne extends CommonObjectLine
// Update object
$this->date_cloture = $date_end_real;
$this->date_end_real = $date_end_real;
$this->fk_user_cloture = $user->id;
$this->commentaire = $comment;

View File

@ -133,14 +133,19 @@ if (preg_match('/\.\./', $upload_dir) || preg_match('/[<>|]/', $upload_dir)) {
exit;
}
if (empty($modulepart)) {
$modulepart = $module;
}
// Check permissions
if ($modulepart == 'ecm') {
if (!$user->rights->ecm->read) {
if (!$user->hasRight('ecm', 'read')) {
accessforbidden();
}
}
if ($modulepart == 'medias') {
} elseif ($modulepart == 'medias' || $modulepart == 'website') {
// Always allowed
} else {
accessforbidden();
}
@ -174,7 +179,7 @@ if (!dol_is_dir($upload_dir)) {
exit;*/
}
print '<!-- ajaxdirpreview type='.$type.' -->'."\n";
print '<!-- ajaxdirpreview type='.$type.' module='.$module.' modulepart='.$modulepart.'-->'."\n";
//print '<!-- Page called with mode='.dol_escape_htmltag(isset($mode)?$mode:'').' type='.dol_escape_htmltag($type).' module='.dol_escape_htmltag($module).' url='.dol_escape_htmltag($url).' '.dol_escape_htmltag($_SERVER["PHP_SELF"]).'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]).' -->'."\n";
$param = ($sortfield ? '&sortfield='.urlencode($sortfield) : '').($sortorder ? '&sortorder='.urlencode($sortorder) : '');
@ -357,31 +362,31 @@ if ($type == 'directory') {
if ($module == 'medias') {
$useinecm = 6;
$modulepart = 'medias';
$perm = ($user->rights->website->write || $user->rights->emailing->creer);
$perm = ($user->hasRight("website", "write") || $user->hasRight("emailing", "creer"));
$title = 'none';
} elseif ($module == 'ecm') { // DMS/ECM -> manual structure
if ($user->rights->ecm->read) {
if ($user->hasRight("ecm", "read")) {
// Buttons: Preview
$useinecm = 2;
}
if ($user->rights->ecm->upload) {
if ($user->hasRight("ecm", "upload")) {
// Buttons: Preview + Delete
$useinecm = 4;
}
if ($user->rights->ecm->setup) {
if ($user->hasRight("ecm", "setup")) {
// Buttons: Preview + Delete + Edit
$useinecm = 5;
}
$perm = $user->rights->ecm->upload;
$perm = $user->hasRight("ecm", "upload");
$modulepart = 'ecm';
$title = ''; // Use default
} else {
$useinecm = 5;
$modulepart = 'ecm';
$perm = $user->rights->ecm->upload;
$perm = $user->hasRight("ecm", "upload");
$title = ''; // Use default
}

View File

@ -84,7 +84,7 @@ $fullpathselecteddir = '<none>';
if ($modulepart == 'ecm') {
$fullpathselecteddir = $conf->ecm->dir_output.'/'.($selecteddir != '/' ? $selecteddir : '');
$fullpathpreopened = $conf->ecm->dir_output.'/'.($preopened != '/' ? $preopened : '');
} elseif ($modulepart == 'medias') {
} elseif ($modulepart == 'medias' || $modulepart == 'website') {
$fullpathselecteddir = $dolibarr_main_data_root.'/medias/'.($selecteddir != '/' ? $selecteddir : '');
$fullpathpreopened = $dolibarr_main_data_root.'/medias/'.($preopened != '/' ? $preopened : '');
}
@ -99,15 +99,27 @@ if (preg_match('/\.\./', $fullpathselecteddir) || preg_match('/[<>|]/', $fullpat
exit;
}
if (empty($modulepart)) {
$modulepart = $module;
}
// Check permissions
if ($modulepart == 'ecm') {
if (!$user->rights->ecm->read) {
if (!$user->hasRight('ecm', 'read')) {
accessforbidden();
}
} elseif ($modulepart == 'medias') {
} elseif ($modulepart == 'medias' || $modulepart == 'website') {
// Always allowed
} else {
accessforbidden();
}
/*
* Actions
*/
// None
/*
* View

View File

@ -219,6 +219,10 @@ if ($action == "importSignature") {
if ($result < 0) {
$error++;
}
$result = $object->call_trigger('PROPAL_CLOSE_SIGNED_WEB', $user);
if ($result < 0) {
$error++;
}
}
} else {
$db->rollback();

View File

@ -68,22 +68,22 @@ $arrayresult = array();
// Define $searchform
if (isModEnabled('adherent') && empty($conf->global->MAIN_SEARCHFORM_ADHERENT_DISABLED) && $user->hasRight('adherent', 'lire')) {
$arrayresult['searchintomember'] = array('position'=>8, 'shortcut'=>'M', 'img'=>'object_member', 'label'=>$langs->trans("SearchIntoMembers", $search_boxvalue), 'text'=>img_picto('', 'object_member', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoMembers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/adherents/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
$arrayresult['searchintomember'] = array('position'=>8, 'shortcut'=>'M', 'img'=>'object_member', 'label'=>$langs->trans("SearchIntoMembers", $search_boxvalue), 'text'=>img_picto('', 'object_member', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoMembers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/adherents/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : ''));
}
if (((isModEnabled('societe') && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))) || ((isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled('supplier_order') || isModEnabled('supplier_invoice'))) && empty($conf->global->MAIN_SEARCHFORM_SOCIETE_DISABLED) && $user->hasRight('societe', 'lire')) {
$arrayresult['searchintothirdparty'] = array('position'=>10, 'shortcut'=>'T', 'img'=>'object_company', 'label'=>$langs->trans("SearchIntoThirdparties", $search_boxvalue), 'text'=>img_picto('', 'object_company', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoThirdparties", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/societe/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
$arrayresult['searchintothirdparty'] = array('position'=>10, 'shortcut'=>'T', 'img'=>'object_company', 'label'=>$langs->trans("SearchIntoThirdparties", $search_boxvalue), 'text'=>img_picto('', 'object_company', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoThirdparties", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/societe/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : ''));
}
if (isModEnabled('societe') && empty($conf->global->MAIN_SEARCHFORM_CONTACT_DISABLED) && $user->hasRight('societe', 'lire')) {
$arrayresult['searchintocontact'] = array('position'=>15, 'shortcut'=>'A', 'img'=>'object_contact', 'label'=>$langs->trans("SearchIntoContacts", $search_boxvalue), 'text'=>img_picto('', 'object_contact', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoContacts", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/contact/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
$arrayresult['searchintocontact'] = array('position'=>15, 'shortcut'=>'A', 'img'=>'object_contact', 'label'=>$langs->trans("SearchIntoContacts", $search_boxvalue), 'text'=>img_picto('', 'object_contact', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoContacts", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/contact/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : ''));
}
if (((isModEnabled('product') && $user->hasRight('product', 'read')) || (isModEnabled('service') && $user->hasRight('service', 'read'))) && empty($conf->global->MAIN_SEARCHFORM_PRODUITSERVICE_DISABLED)) {
$arrayresult['searchintoproduct'] = array('position'=>30, 'shortcut'=>'P', 'img'=>'object_product', 'label'=>$langs->trans("SearchIntoProductsOrServices", $search_boxvalue), 'text'=>img_picto('', 'object_product', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoProductsOrServices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/product/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
$arrayresult['searchintoproduct'] = array('position'=>30, 'shortcut'=>'P', 'img'=>'object_product', 'label'=>$langs->trans("SearchIntoProductsOrServices", $search_boxvalue), 'text'=>img_picto('', 'object_product', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoProductsOrServices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/product/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : ''));
// search on lot/serial numbers
if (isModEnabled('productbatch')) {
$arrayresult['searchintobatch'] = array('position'=>32, 'shortcut'=>'B', 'img'=>'object_lot', 'label'=>$langs->trans("SearchIntoBatch", $search_boxvalue), 'text'=>img_picto('', 'object_lot', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoBatch", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/product/stock/productlot_list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
$arrayresult['searchintobatch'] = array('position'=>32, 'shortcut'=>'B', 'img'=>'object_lot', 'label'=>$langs->trans("SearchIntoBatch", $search_boxvalue), 'text'=>img_picto('', 'object_lot', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoBatch", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/product/stock/productlot_list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : ''));
}
}
@ -98,26 +98,26 @@ if (isModEnabled('project') && empty($conf->global->MAIN_SEARCHFORM_TASK_DISABLE
}
if (isModEnabled('propal') && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_PROPAL_DISABLED) && $user->hasRight('propal', 'lire')) {
$arrayresult['searchintopropal'] = array('position'=>60, 'img'=>'object_propal', 'label'=>$langs->trans("SearchIntoCustomerProposals", $search_boxvalue), 'text'=>img_picto('', 'object_propal', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoCustomerProposals", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/comm/propal/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
$arrayresult['searchintopropal'] = array('position'=>60, 'img'=>'object_propal', 'label'=>$langs->trans("SearchIntoCustomerProposals", $search_boxvalue), 'text'=>img_picto('', 'object_propal', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoCustomerProposals", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/comm/propal/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : ''));
}
if (isModEnabled('commande') && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_ORDER_DISABLED) && $user->hasRight('commande', 'lire')) {
$arrayresult['searchintoorder'] = array('position'=>70, 'img'=>'object_order', 'label'=>$langs->trans("SearchIntoCustomerOrders", $search_boxvalue), 'text'=>img_picto('', 'object_order', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoCustomerOrders", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/commande/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
$arrayresult['searchintoorder'] = array('position'=>70, 'img'=>'object_order', 'label'=>$langs->trans("SearchIntoCustomerOrders", $search_boxvalue), 'text'=>img_picto('', 'object_order', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoCustomerOrders", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/commande/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : ''));
}
if (isModEnabled('expedition') && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_SHIPMENT_DISABLED) && $user->hasRight('expedition', 'lire')) {
$arrayresult['searchintoshipment'] = array('position'=>80, 'img'=>'object_shipment', 'label'=>$langs->trans("SearchIntoCustomerShipments", $search_boxvalue), 'text'=>img_picto('', 'object_shipment', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoCustomerShipments", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/expedition/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
$arrayresult['searchintoshipment'] = array('position'=>80, 'img'=>'object_shipment', 'label'=>$langs->trans("SearchIntoCustomerShipments", $search_boxvalue), 'text'=>img_picto('', 'object_shipment', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoCustomerShipments", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/expedition/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : ''));
}
if (isModEnabled('facture') && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_INVOICE_DISABLED) && $user->hasRight('facture', 'lire')) {
$arrayresult['searchintoinvoice'] = array('position'=>90, 'img'=>'object_bill', 'label'=>$langs->trans("SearchIntoCustomerInvoices", $search_boxvalue), 'text'=>img_picto('', 'object_bill', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoCustomerInvoices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/compta/facture/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
$arrayresult['searchintoinvoice'] = array('position'=>90, 'img'=>'object_bill', 'label'=>$langs->trans("SearchIntoCustomerInvoices", $search_boxvalue), 'text'=>img_picto('', 'object_bill', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoCustomerInvoices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/compta/facture/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : ''));
}
if (isModEnabled('supplier_proposal') && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_PROPAL_DISABLED) && $user->hasRight('supplier_proposal', 'lire')) {
$arrayresult['searchintosupplierpropal'] = array('position'=>100, 'img'=>'object_supplier_proposal', 'label'=>$langs->trans("SearchIntoSupplierProposals", $search_boxvalue), 'text'=>img_picto('', 'object_supplier_proposal', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoSupplierProposals", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/supplier_proposal/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
$arrayresult['searchintosupplierpropal'] = array('position'=>100, 'img'=>'object_supplier_proposal', 'label'=>$langs->trans("SearchIntoSupplierProposals", $search_boxvalue), 'text'=>img_picto('', 'object_supplier_proposal', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoSupplierProposals", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/supplier_proposal/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : ''));
}
if (((isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight('fournisseur', 'commande', 'lire')) || (isModEnabled('supplier_order') && $user->hasRight('supplier_order', 'lire'))) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_ORDER_DISABLED)) {
$arrayresult['searchintosupplierorder'] = array('position'=>110, 'img'=>'object_supplier_order', 'label'=>$langs->trans("SearchIntoSupplierOrders", $search_boxvalue), 'text'=>img_picto('', 'object_supplier_order', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoSupplierOrders", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fourn/commande/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : ''));
}
if (((isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight('fournisseur', 'facture', 'lire')) || (isModEnabled('supplier_invoice') && $user->hasRight('supplier_invoice', 'lire'))) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_INVOICE_DISABLED)) {
$arrayresult['searchintosupplierinvoice'] = array('position'=>120, 'img'=>'object_supplier_invoice', 'label'=>$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'text'=>img_picto('', 'object_supplier_invoice', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fourn/facture/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
$arrayresult['searchintosupplierinvoice'] = array('position'=>120, 'img'=>'object_supplier_invoice', 'label'=>$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'text'=>img_picto('', 'object_supplier_invoice', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fourn/facture/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : ''));
}
// Customer payments
@ -127,7 +127,7 @@ if (isModEnabled('facture') && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_INV
'img'=>'object_payment',
'label'=>$langs->trans("SearchIntoCustomerPayments", $search_boxvalue),
'text'=>img_picto('', 'object_payment', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoCustomerPayments", $search_boxvalue),
'url'=>DOL_URL_ROOT.'/compta/paiement/list.php?leftmenu=customers_bills_payment'.($search_boxvalue ? '&sall='.urlencode($search_boxvalue) : ''));
'url'=>DOL_URL_ROOT.'/compta/paiement/list.php?leftmenu=customers_bills_payment'.($search_boxvalue ? '&search_all='.urlencode($search_boxvalue) : ''));
}
// Vendor payments
@ -137,7 +137,7 @@ if (((isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERM
'img'=>'object_payment',
'label'=>$langs->trans("SearchIntoVendorPayments", $search_boxvalue),
'text'=>img_picto('', 'object_payment', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoVendorPayments", $search_boxvalue),
'url'=>DOL_URL_ROOT.'/fourn/paiement/list.php?leftmenu=suppliers_bills_payment'.($search_boxvalue ? '&sall='.urlencode($search_boxvalue) : ''));
'url'=>DOL_URL_ROOT.'/fourn/paiement/list.php?leftmenu=suppliers_bills_payment'.($search_boxvalue ? '&search_all='.urlencode($search_boxvalue) : ''));
}
// Miscellaneous payments
@ -147,28 +147,31 @@ if (isModEnabled('banque') && empty($conf->global->MAIN_SEARCHFORM_MISC_PAYMENTS
'img'=>'object_payment',
'label'=>$langs->trans("SearchIntoMiscPayments", $search_boxvalue),
'text'=>img_picto('', 'object_payment', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoMiscPayments", $search_boxvalue),
'url'=>DOL_URL_ROOT.'/compta/bank/various_payment/list.php?leftmenu=tax_various'.($search_boxvalue ? '&sall='.urlencode($search_boxvalue) : ''));
'url'=>DOL_URL_ROOT.'/compta/bank/various_payment/list.php?leftmenu=tax_various'.($search_boxvalue ? '&search_all='.urlencode($search_boxvalue) : ''));
}
if (isModEnabled('contrat') && empty($conf->global->MAIN_SEARCHFORM_CONTRACT_DISABLED) && $user->hasRight('contrat', 'lire')) {
$arrayresult['searchintocontract'] = array('position'=>130, 'img'=>'object_contract', 'label'=>$langs->trans("SearchIntoContracts", $search_boxvalue), 'text'=>img_picto('', 'object_contract', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoContracts", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/contrat/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
$arrayresult['searchintocontract'] = array('position'=>130, 'img'=>'object_contract', 'label'=>$langs->trans("SearchIntoContracts", $search_boxvalue), 'text'=>img_picto('', 'object_contract', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoContracts", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/contrat/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : ''));
}
if (isModEnabled('ficheinter') && empty($conf->global->MAIN_SEARCHFORM_FICHINTER_DISABLED) && $user->hasRight('ficheinter', 'lire')) {
$arrayresult['searchintointervention'] = array('position'=>140, 'img'=>'object_intervention', 'label'=>$langs->trans("SearchIntoInterventions", $search_boxvalue), 'text'=>img_picto('', 'object_intervention', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoInterventions", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fichinter/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
$arrayresult['searchintointervention'] = array('position'=>140, 'img'=>'object_intervention', 'label'=>$langs->trans("SearchIntoInterventions", $search_boxvalue), 'text'=>img_picto('', 'object_intervention', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoInterventions", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fichinter/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : ''));
}
if (isModEnabled('knowledgemanagement') && empty($conf->global->MAIN_SEARCHFORM_KNOWLEDGEMANAGEMENT_DISABLED) && $user->hasRight('knowledgemanagement', 'knowledgerecord', 'read')) {
$arrayresult['searchintoknowledgemanagement'] = array('position'=>145, 'img'=>'object_knowledgemanagement', 'label'=>$langs->trans("SearchIntoKM", $search_boxvalue), 'text'=>img_picto('', 'object_knowledgemanagement', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoKM", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/knowledgemanagement/knowledgerecord_list.php?mainmenu=ticket'.($search_boxvalue ? '&search_all='.urlencode($search_boxvalue) : ''));
}
if (isModEnabled('ticket') && empty($conf->global->MAIN_SEARCHFORM_TICKET_DISABLED) && $user->hasRight('ticket', 'read')) {
$arrayresult['searchintotickets'] = array('position'=>145, 'img'=>'object_ticket', 'label'=>$langs->trans("SearchIntoTickets", $search_boxvalue), 'text'=>img_picto('', 'object_ticket', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoTickets", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/ticket/list.php?mainmenu=ticket'.($search_boxvalue ? '&sall='.urlencode($search_boxvalue) : ''));
$arrayresult['searchintotickets'] = array('position'=>146, 'img'=>'object_ticket', 'label'=>$langs->trans("SearchIntoTickets", $search_boxvalue), 'text'=>img_picto('', 'object_ticket', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoTickets", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/ticket/list.php?mainmenu=ticket'.($search_boxvalue ? '&search_all='.urlencode($search_boxvalue) : ''));
}
// HR
if (isModEnabled('user') && empty($conf->global->MAIN_SEARCHFORM_USER_DISABLED) && $user->hasRight('user', 'user', 'lire')) {
$arrayresult['searchintouser'] = array('position'=>200, 'shortcut'=>'U', 'img'=>'object_user', 'label'=>$langs->trans("SearchIntoUsers", $search_boxvalue), 'text'=>img_picto('', 'object_user', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoUsers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/user/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
$arrayresult['searchintouser'] = array('position'=>200, 'shortcut'=>'U', 'img'=>'object_user', 'label'=>$langs->trans("SearchIntoUsers", $search_boxvalue), 'text'=>img_picto('', 'object_user', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoUsers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/user/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : ''));
}
if (isModEnabled('expensereport') && empty($conf->global->MAIN_SEARCHFORM_EXPENSEREPORT_DISABLED) && $user->hasRight('expensereport', 'lire')) {
$arrayresult['searchintoexpensereport'] = array('position'=>210, 'img'=>'object_trip', 'label'=>$langs->trans("SearchIntoExpenseReports", $search_boxvalue), 'text'=>img_picto('', 'object_trip', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoExpenseReports", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm'.($search_boxvalue ? '&sall='.urlencode($search_boxvalue) : ''));
$arrayresult['searchintoexpensereport'] = array('position'=>210, 'img'=>'object_trip', 'label'=>$langs->trans("SearchIntoExpenseReports", $search_boxvalue), 'text'=>img_picto('', 'object_trip', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoExpenseReports", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm'.($search_boxvalue ? '&search_all='.urlencode($search_boxvalue) : ''));
}
if (isModEnabled('holiday') && empty($conf->global->MAIN_SEARCHFORM_HOLIDAY_DISABLED) && $user->hasRight('holiday', 'read')) {
$arrayresult['searchintoleaves'] = array('position'=>220, 'img'=>'object_holiday', 'label'=>$langs->trans("SearchIntoLeaves", $search_boxvalue), 'text'=>img_picto('', 'object_holiday', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoLeaves", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/holiday/list.php?mainmenu=hrm'.($search_boxvalue ? '&sall='.urlencode($search_boxvalue) : ''));
$arrayresult['searchintoleaves'] = array('position'=>220, 'img'=>'object_holiday', 'label'=>$langs->trans("SearchIntoLeaves", $search_boxvalue), 'text'=>img_picto('', 'object_holiday', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoLeaves", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/holiday/list.php?mainmenu=hrm'.($search_boxvalue ? '&search_all='.urlencode($search_boxvalue) : ''));
}
// Execute hook addSearchEntry

View File

@ -84,7 +84,7 @@ class box_activity extends ModeleBoxes
$totalnb = 0;
$line = 0;
$cachetime = 3600;
$fileid = '-e'.$conf->entity.'-u'.$user->id.'-s'.$user->socid.'-r'.($user->rights->societe->client->voir ? '1' : '0').'.cache';
$fileid = '-e'.$conf->entity.'-u'.$user->id.'-s'.$user->socid.'-r'.($user->hasRight("societe", "client", "voir") ? '1' : '0').'.cache';
$now = dol_now();
$nbofperiod = 3;
@ -102,7 +102,7 @@ class box_activity extends ModeleBoxes
// list the summary of the propals
if (isModEnabled("propal") && $user->rights->propal->lire) {
if (isModEnabled("propal") && $user->hasRight("propal", "lire")) {
include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
$propalstatic = new Propal($this->db);
@ -189,7 +189,7 @@ class box_activity extends ModeleBoxes
}
// list the summary of the orders
if (isModEnabled('commande') && $user->rights->commande->lire) {
if (isModEnabled('commande') && $user->hasRight("commande", "lire")) {
include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
$commandestatic = new Commande($this->db);
@ -278,7 +278,7 @@ class box_activity extends ModeleBoxes
// list the summary of the bills
if (isModEnabled('facture') && $user->rights->facture->lire) {
if (isModEnabled('facture') && $user->hasRight("facture", "lire")) {
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$facturestatic = new Facture($this->db);

View File

@ -76,7 +76,7 @@ class box_bookmarks extends ModeleBoxes
'text' => $langs->trans("BoxMyLastBookmarks", $max),
'sublink' => DOL_URL_ROOT.'/bookmarks/list.php',
);
if ($user->rights->bookmark->creer) {
if ($user->hasRight("bookmark", "creer")) {
$this->info_box_head['subpicto'] = 'bookmark';
$this->info_box_head['subtext'] = $langs->trans("BookmarksManagement");
} else {
@ -121,7 +121,7 @@ class box_bookmarks extends ModeleBoxes
if ($num == 0) {
$mytxt = $langs->trans("NoRecordedBookmarks");
if ($user->rights->bookmark->creer) {
if ($user->hasRight("bookmark", "creer")) {
$mytxt .= ' '.$langs->trans("ClickToAdd");
}
$this->info_box_contents[$line][0] = array(

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