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

This commit is contained in:
atm-lena 2022-08-24 11:38:19 +02:00
commit 6e5d395ac8
1353 changed files with 90869 additions and 10987 deletions

3
.gitignore vendored
View File

@ -42,6 +42,8 @@ htdocs/includes/sebastian/
htdocs/includes/squizlabs/
htdocs/includes/webmozart/
htdocs/.well-known/apple-developer-merchantid-domain-association
/factory/
/output/
# Node Modules
build/yarn-error.log
@ -55,4 +57,3 @@ yarn.lock
package-lock.json
doc/install.lock
/factory/

View File

@ -54,11 +54,11 @@ jobs:
env: DB=mysql
- stage: PHP Dev
if: type = push AND branch = develop
php: nightly
php: nightly
env: DB=mysql
- stage: PHP Dev
if: type = push AND branch = 15.0
php: nightly
php: nightly
env: DB=mysql
notifications:
@ -289,7 +289,7 @@ script:
--exclude htdocs/includes/sabre --exclude htdocs/includes/phpoffice/PhpSpreadsheet --exclude htdocs/includes/sebastian \
--exclude htdocs/includes/squizlabs/php_codesniffer --exclude htdocs/includes/jakub-onderka --exclude htdocs/includes/php-parallel-lint --exclude htdocs/includes/symfony \
--exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/maximebf \
--exclude htdocs/includes/phpunit/ --exclude htdocs/includes/tecnickcom/tcpdf/include/barcodes --exclude htdocs/includes/webmozart --blame .
--exclude htdocs/includes/phpunit/ --exclude htdocs/includes/tecnickcom/tcpdf/include/barcodes --exclude htdocs/includes/webmozart --exclude htdocs/includes/webklex --blame .
fi
set +e
echo

View File

@ -141,7 +141,7 @@ NEW: Added MMK currency (Myanmar Kyat)
Modules
NEW: Module Partnership Management
NEW: Experimental Module Event Organization Management
NEW: Module Event Organization Management
For developers or integrators:
@ -149,7 +149,6 @@ For developers or integrators:
NEW: dol_uncompress() supports more extensions (.gz, .bz2, .zstd). Only .zip was supported before.
NEW: Implement a generic method for Kaban views
NEW: Upgrade chartjs library to 3.7.1
NEW: update rank line is possible on API for customer invoices, sales orders and supplier invoice
NEW: stripe element with more gateways
NEW: solde() function evolution to be able to get solde until a chosen date
NEW: Suggest a way to run upgrade per entities.
@ -158,7 +157,6 @@ NEW: ModuleBuilder - Add tabs view in module builder
NEW: ModuleBuilder - More feature that can be modifed after module generation
NEW: Identification of tr is possible with by attribute data-id on some pages
NEW: Import with select boxes V2
NEW: Can update rank of invoice, proposal and order lines with API update
NEW: Can use current entity filter on 'chkbxlst'
NEW: Creation of the function select_bom() used to display bom select list
NEW: add printFieldListWhere hook in product reassort card
@ -166,32 +164,33 @@ NEW: Add trigger and event on completely received status change
NEW: Add utility function send backup by mail
NEW: add WordPress OAuth to save a token (not SSO)
NEW: A module can embed a sql script run at each Dolibarr upgrade
NEW: API Proposals - Add POST lines
NEW: API REST filter states by country
NEW: Add option INVOICEREC_SET_AUTOFILL_DATE_START/END
NEW: Add option MAIN_API_DEBUG to save API logs into a file
NEW: Add param to keep the robot=index meta tag on public pages
NEW: Add method hintindex() in database handlers.
NEW: add modifications for new function "$db->prefix()"
NEW: addMoreActionsButtonsList hook for button in list
NEW: Add API to get a template invoice
NEW: Standardize a lot of code.
NEW: #20736 Allow extrafields SQL filters on REST API product lookup
NEW: #19294 implement detailed timespent in task of project API
NEW: Add a protection into PHPunit to avoid to forget a var_dump
NEW: Add datem and type parameters to API to create movements
NEW: Add hidden option on contract PDF line to hide qty and price
NEW: Option MAIL_MASS_ACTION_ADD_LAST_IF_MAIN_DOC_NOT_FOUND to send last document in mass mailing action
API:
NEW: API Proposals - Add POST lines
NEW: API REST filter states by country
NEW: Add API to get a template invoice
NEW: Add datem and type parameters to API to create movements
NEW: #19294 implement detailed timespent in task of project API
NEW: #20736 Allow extrafields SQL filters on REST API product lookup
NEW: Can update rank of invoice, proposal and order lines with API update
NEW: update rank line is possible on API for customer invoices, sales orders and supplier invoice
NEW: Add option MAIN_API_DEBUG to save API logs into a file
Hooks:
NEW: Hook getNomUrl available everywhere in tooltip of ref links
NEW: Add hooks: selectContactListWhere hook, selectThirdpartyListWhere hook
NEW: TakePos - add hooks complete product display
NEW: TakePos - add hooks for cart display
NEW: TakePos - add hooks to complete ajax return array
NEW: Add hook before the public ticket list
NEW: Add hook doaction in takepos invoice
NEW: Add Hook for Notif
NEW: Add hook for Notif
NEW: Add hook for more buttons
NEW: Add hook printFieldListWhere in "show_contacts" function
NEW: Add hook printFieldWhere in load_state_board function
@ -204,6 +203,9 @@ NEW: Add hooks on project task time page
NEW: Add hooks on salaries and sociales card
NEW: Add hooks select product list and select thirdparty list function
NEW: Add hook to getSellPrice function
NEW: TakePos - add hooks complete product display
NEW: TakePos - add hooks for cart display
NEW: TakePos - add hooks to complete ajax return array
WARNING:
@ -233,10 +235,8 @@ FIX: #18704
FIX: #20444
FIX: #20448 missing preg_replace for vat rate when adding a free line
FIX: #20476 migration postgresql 13.0.x to 14.0.x packaging type
FIX: #20487 missing letter D in constant THIRDPARTIES_DISABLE_RELATED_…
FIX: #20487 missing letter D in constant THIRDPARTIES_DISABLE_RELATED_OBJECT_TAB
FIX: #20527 Accountancy - Unbalanced entry proposed when an employee are declared on a social contribution
FIX: #20527 Accountancy Unbalanced entry proposed when an employee are declared on social contribution
FIX: #20621 signature online with proposal with n page.
FIX: #20696
FIX: #20828
@ -272,7 +272,7 @@ FIX: fourn/commande/card.php Added "$object" parameter to $formfile->showdocumen
FIX: french traductions for payment methods
FIX: hook for dol_format_address
FIX: Index page for "Sales" give wrong URL link to Intervention
FIX: issue Dolibarr#21495 for v15
FIX: issue Dolibarr #21495 for v15
FIX: label and get_substitutionarray_each_var_object on ODT generation
FIX: load product stock in inventory lines
FIX: missing morecss for multiselectarray

View File

@ -1,4 +1,6 @@
#!/bin/bash
# Script used by the Dockerfile.
# See README.md to know how to create a Dolibarr env with docker
usermod -u ${HOST_USER_ID} www-data
groupmod -g ${HOST_USER_ID} www-data

View File

@ -174,7 +174,7 @@ if [ -s "$mydir/initdemopostsql.sql" ]; then
echo A file initdemopostsql.sql was found, we execute it.
mysql -P$port $base < "$mydir/initdemopostsql.sql"
else
echo No file initdemopostsql.sql found, we extra sql action done.
echo No file initdemopostsql.sql found, so no extra sql action done.
fi

Binary file not shown.

View File

@ -4,4 +4,5 @@ terms
(en) VAT = Value Added Tax
(fr) TVA = Taxe sur la Valeur Ajouté
(es) NIF / CIF
(de) USt / MwSt
(de) USt / MwSt = UmsatzSteuer / Mehrwertsteuer
(it) IVA

View File

@ -0,0 +1,10 @@
VAT Rates
---------
https://www.taxrates.cc/index.html
https://en.wikipedia.org/wiki/List_of_countries_by_tax_rates
For India: VAT=IGST / CGST=Localtax1 / SGST=Localtax2
see:
https://cleartax.in/s/what-is-sgst-cgst-igst
https://www.mastersindia.co/blog/what-is-cgst-sgst-igst-and-ugst/

View File

@ -1,8 +0,0 @@
VAT Rates
---------
http://www.taxrates.cc/index.html
https://en.wikipedia.org/wiki/List_of_countries_by_tax_rates
For India: VAT=IGST/CGST=Localtax1/SGST=Localtax2: https://cleartax.in/s/what-is-sgst-cgst-igst

View File

@ -135,7 +135,7 @@
<rule ref="Generic.Metrics.CyclomaticComplexity">
<properties>
<property name="complexity" value="250" />
<property name="absoluteComplexity" value="300" />
<property name="absoluteComplexity" value="400" />
</properties>
</rule>
<rule ref="Generic.Metrics.NestingLevel">

View File

@ -10,6 +10,7 @@
# Syntax
if [ "x$1" != "xlist" -a "x$1" != "xfix" ]
then
echo "Detect .sh and .spec files that does not contains any tab inside"
echo "Usage: fixnotabfiles.sh [list|fix]"
fi

View File

@ -17,14 +17,14 @@ fi
# To detec
if [ "x$1" = "xlist" ]
then
find . \( -iname "functions" -o -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.sql" -o -iname "*.txt" -o -iname "*.xml" -o -iname "*.pml" \) -exec file "{}" + | grep -v 'custom\/' | grep -v 'documents\/website' | grep -v 'documents\/medias' | grep -v 'documents\/sellyoursaas' | grep CRLF
# find . \( -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.sql" -o -iname "*.txt" -o -iname "*.xml" \) -exec file "{}" + | grep -v 'custom\/' | grep -v 'documents\/website' | grep -v 'documents\/medias' | grep -v 'documents\/sellyoursaas' | grep -v 'htdocs\/includes' | grep CRLF
find . \( -iname "functions" -o -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.sql" -o -iname "*.txt" -o -iname "*.xml" -o -iname "*.pml" \) -exec file "{}" + | grep -v "CRLF" | grep -v 'custom\/' | grep -v 'documents\/website' | grep -v 'documents\/medias' | grep -v 'documents\/sellyoursaas' | grep CRLF
# find . \( -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.sql" -o -iname "*.txt" -o -iname "*.xml" \) -exec file "{}" + | grep -v "CRLF" | grep -v 'custom\/' | grep -v 'documents\/website' | grep -v 'documents\/medias' | grep -v 'documents\/sellyoursaas' | grep -v 'htdocs\/includes' | grep CRLF
fi
# To convert
if [ "x$1" = "xfix" ]
then
for fic in `find . \( -iname "functions" -o -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.sql" -o -iname "*.txt" -o -iname "*.xml" -o -iname "*.pml" \) -exec file "{}" + | grep -v 'custom\/' | grep -v 'documents\/website' | grep -v 'documents\/medias' | grep -v 'documents\/sellyoursaas' | grep CRLF | awk -F':' '{ print $1 }' `
for fic in `find . \( -iname "functions" -o -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.sql" -o -iname "*.txt" -o -iname "*.xml" -o -iname "*.pml" \) -exec file "{}" + | grep -v "CRLF" | grep -v 'custom\/' | grep -v 'documents\/website' | grep -v 'documents\/medias' | grep -v 'documents\/sellyoursaas' | grep CRLF | awk -F':' '{ print $1 }' `
do
echo "Fix file $fic"
dos2unix "$fic"

View File

@ -39,13 +39,14 @@ optimize_image()
max_input_size=$(expr $max_input_size + $input_file_size)
if [ "${1##*.}" = "png" ]; then
#optipng -o1 -clobber -quiet $1 -out $2.firstpass
optipng -o1 -quiet $1 -out $2.firstpass
pngcrush -q -rem alla -reduce $2.firstpass $2 >/dev/null
rm -fr $2.firstpass
#optipng -o1 -clobber -quiet "$1" -out "$2.firstpass"
echo optipng -o1 -quiet "$1" -out "$2.firstpass"
optipng -o1 -quiet "$1" -out "$2.firstpass"
pngcrush -q -rem alla -reduce "$2.firstpass" "$2" >/dev/null
rm -fr "$2.firstpass"
fi
if [ "${1##*.}" = "jpg" -o "${1##*.}" = "jpeg" ]; then
jpegtran -copy none -progressive $1 > $2
jpegtran -copy none -progressive "$1" > $2
fi
output_file_size=$(stat -c%s "$2")
@ -120,8 +121,8 @@ main()
# Search of all jpg/jpeg/png in $INPUT
# We remove images from $OUTPUT if $OUTPUT is a subdirectory of $INPUT
echo "Scan $INPUT to find images"
IMAGES=$(find $INPUT -regextype posix-extended -regex '.*\.(jpg|jpeg|png)' | grep -v $OUTPUT)
echo "Scan $INPUT to find images with find $INPUT -regextype posix-extended -regex '.*\.(jpg|jpeg|png)' | grep -v '/gource/' | grep -v '/includes/' | grep -v '/custom/' | grep -v $OUTPUT"
IMAGES=$(find $INPUT -regextype posix-extended -regex '.*\.(jpg|jpeg|png)' | grep -v '/gource/' | grep -v '/includes/' | grep -v '/custom/' | grep -v '/documents/' | grep -v $OUTPUT)
if [ "$QUIET" == "0" ]; then
echo --- Optimizing $INPUT ---
@ -135,11 +136,11 @@ main()
printf '%*.*s' 0 $((linelength - ${#filename} - ${#sDone} )) "$pad"
fi
optimize_image $CURRENT_IMAGE $OUTPUT/$filename
optimize_image "$CURRENT_IMAGE" "$OUTPUT/$filename"
# Replace file
if [[ "$INPLACE" == "1" ]]; then
mv $OUTPUT/$filename $CURRENT_IMAGE
mv "$OUTPUT/$filename" "$CURRENT_IMAGE"
fi
if [ "$QUIET" == "0" ]; then

View File

@ -52,8 +52,8 @@ $confirm = GETPOST('confirm', 'alpha');
$chartofaccounts = GETPOST('chartofaccounts', 'int');
$permissiontoadd = !empty($user->rights->accounting->chartofaccount);
$permissiontodelete = !empty($user->rights->accounting->chartofaccount);
$permissiontoadd = $user->hasRight('accounting', 'chartofaccount');
$permissiontodelete = $user->hasRight('accounting', 'chartofaccount');
// Security check
if ($user->socid > 0) {
@ -294,7 +294,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
}
// List of mass actions available
if ($user->rights->accounting->chartofaccount) {
if ($user->hasRight('accounting', 'chartofaccount')) {
$arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
}
if (in_array($massaction, array('presend', 'predelete', 'closed'))) {
@ -590,7 +590,7 @@ if ($resql) {
// Action
print '<td class="center nowraponall">';
if ($user->rights->accounting->chartofaccount) {
if ($user->hasRight('accounting', 'chartofaccount')) {
print '<a class="editfielda" href="./card.php?action=update&token='.newToken().'&id='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?'.$param).'">';
print img_edit();
print '</a>';

View File

@ -39,7 +39,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
if (!empty($conf->accounting->enabled)) {
if (isModEnabled('accounting')) {
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
}
@ -126,7 +126,7 @@ $tabrowid[31] = "";
// Condition to show dictionary in setup page
$tabcond = array();
$tabcond[31] = !empty($conf->accounting->enabled);
$tabcond[31] = isModEnabled('accounting');
// List of help for fields
$tabhelp = array();

View File

@ -66,7 +66,7 @@ if (GETPOST('cancel', 'alpha')) {
exit;
}
if ($action == 'add' && $user->rights->accounting->chartofaccount) {
if ($action == 'add' && $user->hasRight('accounting', 'chartofaccount')) {
if (!$cancel) {
if (!$account_number) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("AccountNumber")), null, 'errors');
@ -127,7 +127,7 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount) {
}
}
}
} elseif ($action == 'edit' && $user->rights->accounting->chartofaccount) {
} elseif ($action == 'edit' && $user->hasRight('accounting', 'chartofaccount')) {
if (!$cancel) {
if (!$account_number) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("AccountNumber")), null, 'errors');
@ -184,7 +184,7 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount) {
header("Location: ".$urltogo);
exit();
}
} elseif ($action == 'delete' && $user->rights->accounting->chartofaccount) {
} elseif ($action == 'delete' && $user->hasRight('accounting', 'chartofaccount')) {
$result = $object->fetch($id);
if (!empty($object->id)) {
@ -419,13 +419,13 @@ if ($action == 'create') {
*/
print '<div class="tabsAction">';
if (!empty($user->rights->accounting->chartofaccount)) {
if ($user->hasRight('accounting', 'chartofaccount')) {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=update&token='.newToken().'&id='.$object->id.'">'.$langs->trans('Modify').'</a>';
} else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('Modify').'</a>';
}
if (!empty($user->rights->accounting->chartofaccount)) {
if ($user->hasRight('accounting', 'chartofaccount')) {
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id.'">'.$langs->trans('Delete').'</a>';
} else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('Delete').'</a>';

View File

@ -111,7 +111,7 @@ $tabrowid[32] = "";
// Condition to show dictionary in setup page
$tabcond = array();
$tabcond[32] = !empty($conf->accounting->enabled);
$tabcond[32] = isModEnabled('accounting');
// List of help for fields
$tabhelp = array();
@ -875,7 +875,7 @@ function fieldListAccountingCategories($fieldlist, $obj = '', $tabname = '', $co
$formadmin = new FormAdmin($db);
$formcompany = new FormCompany($db);
if (!empty($conf->accounting->enabled)) {
if (isModEnabled('accounting')) {
$formaccounting = new FormAccounting($db);
}

View File

@ -81,22 +81,22 @@ $list_account[] = '---Others---';
$list_account[] = 'ACCOUNTING_VAT_BUY_ACCOUNT';
$list_account[] = 'ACCOUNTING_VAT_SOLD_ACCOUNT';
$list_account[] = 'ACCOUNTING_VAT_PAY_ACCOUNT';
if (!empty($conf->banque->enabled)) {
if (isModEnabled('banque')) {
$list_account[] = 'ACCOUNTING_ACCOUNT_TRANSFER_CASH';
}
if (!empty($conf->don->enabled)) {
if (isModEnabled('don')) {
$list_account[] = 'DONATION_ACCOUNTINGACCOUNT';
}
if (!empty($conf->adherent->enabled)) {
if (isModEnabled('adherent')) {
$list_account[] = 'ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT';
}
if (!empty($conf->loan->enabled)) {
if (isModEnabled('loan')) {
$list_account[] = 'LOAN_ACCOUNTING_ACCOUNT_CAPITAL';
$list_account[] = 'LOAN_ACCOUNTING_ACCOUNT_INTEREST';
$list_account[] = 'LOAN_ACCOUNTING_ACCOUNT_INSURANCE';
}
$list_account[] = 'ACCOUNTING_ACCOUNT_SUSPENSE';
if (!empty($conf->societe->enabled)) {
if (isModEnabled('societe')) {
$list_account[] = '---Deposits---';
}
@ -133,6 +133,12 @@ if ($action == 'update') {
$error++;
}
$constname = 'ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT';
$constvalue = GETPOST($constname, 'int');
if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
$error++;
}
if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
@ -155,6 +161,20 @@ if ($action == 'setACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT') {
}
}
if ($action == 'setACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT') {
$setDisableAuxiliaryAccountOnSupplierDeposit = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "ACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT", $setDisableAuxiliaryAccountOnSupplierDeposit, 'yesno', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
}
if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'mesgs');
}
}
/*
* View
@ -266,7 +286,7 @@ print $formaccounting->select_account(getDolGlobalString('ACCOUNTING_ACCOUNT_CUS
print '</td>';
print '</tr>';
if (!empty($conf->societe->enabled) && getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT') && getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT') != '-1') {
if (isModEnabled('societe') && getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT') && getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT') != '-1') {
print '<tr class="oddeven">';
print '<td>' . img_picto('', 'bill', 'class="pictofixedwidth"') . $langs->trans("UseAuxiliaryAccountOnCustomerDeposit") . '</td>';
if (getDolGlobalInt('ACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT')) {
@ -281,6 +301,33 @@ if (!empty($conf->societe->enabled) && getDolGlobalString('ACCOUNTING_ACCOUNT_CU
print '</tr>';
}
// Supplier deposit account
print '<tr class="oddeven value">';
// Param
print '<td>';
print img_picto('', 'supplier_invoice', 'class="pictofixedwidth"') . $langs->trans('ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT');
print '</td>';
// Value
print '<td class="right">'; // Do not force class=right, or it align also the content of the select box
print $formaccounting->select_account(getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT'), 'ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT', 1, '', 1, 1, 'minwidth100 maxwidth300 maxwidthonsmartphone', 'accounts');
print '</td>';
print '</tr>';
if (isModEnabled('societe') && getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT') && getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT') != '-1') {
print '<tr class="oddeven">';
print '<td>' . img_picto('', 'supplier_invoice', 'class="pictofixedwidth"') . $langs->trans("UseAuxiliaryAccountOnSupplierDeposit") . '</td>';
if (getDolGlobalInt('ACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT')) {
print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?token=' . newToken() . '&action=setACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT&value=0">';
print img_picto($langs->trans("Activated"), 'switch_on', '', false, 0, 0, '', 'warning');
print '</a></td>';
} else {
print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?token=' . newToken() . '&action=setACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT&value=1">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a></td>';
}
print '</tr>';
}
print "</table>\n";
print "</div>\n";

View File

@ -121,7 +121,7 @@ if ($result) {
$i = 0;
$addbutton .= dolGetButtonTitle($langs->trans('NewFiscalYear'), '', 'fa fa-plus-circle', 'fiscalyear_card.php?action=create', '', $user->rights->accounting->fiscalyear->write);
$addbutton .= dolGetButtonTitle($langs->trans('NewFiscalYear'), '', 'fa fa-plus-circle', 'fiscalyear_card.php?action=create', '', $user->hasRight('accounting', 'fiscalyear', 'write'));
$title = $langs->trans('AccountingPeriods');

View File

@ -299,7 +299,7 @@ if ($action == 'create') {
/*
* Action bar
*/
if (!empty($user->rights->accounting->fiscalyear->write)) {
if ($user->hasRight('accounting', 'fiscalyear', 'write')) {
print '<div class="tabsAction">';
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'&id='.$id.'">'.$langs->trans('Modify').'</a>';

View File

@ -123,7 +123,7 @@ $tabrowid[35] = "";
// Condition to show dictionary in setup page
$tabcond = array();
$tabcond[35] = !empty($conf->accounting->enabled);
$tabcond[35] = isModEnabled('accounting');
// List of help for fields
$tabhelp = array();

View File

@ -34,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
if (!empty($conf->categorie->enabled)) {
if (isModEnabled('categorie')) {
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
}
@ -42,7 +42,7 @@ if (!empty($conf->categorie->enabled)) {
$langs->loadLangs(array("companies", "compta", "accountancy", "products"));
// Security check
if (empty($conf->accounting->enabled)) {
if (!isModEnabled('accounting')) {
accessforbidden();
}
if (empty($user->rights->accounting->bind->write)) {
@ -522,7 +522,7 @@ if ($resql) {
// Filter on categories
$moreforfilter = '';
if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) {
if (isModEnabled('categorie') && $user->hasRight('categorie', 'lire')) {
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= img_picto($langs->trans('Categories'), 'category', 'class="pictofixedwidth"');
$categoriesProductArr = $form->select_all_categories(Categorie::TYPE_PRODUCT, '', '', 64, 0, 1);
@ -533,7 +533,7 @@ if ($resql) {
}
//Show/hide child products. Hidden by default
if (!empty($conf->variants->enabled) && !empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD)) {
if (isModEnabled('variants') && !empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD)) {
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= '<input type="checkbox" id="search_show_childproducts" name="search_show_childproducts"'.($show_childproducts ? 'checked="checked"' : '').'>';
$moreforfilter .= ' <label for="search_show_childproducts">'.$langs->trans('ShowChildProducts').'</label>';

View File

@ -142,7 +142,7 @@ if (!empty($search_ledger_code)) {
}
}
if (empty($conf->accounting->enabled)) {
if (!isModEnabled('accounting')) {
accessforbidden();
}
if ($user->socid > 0) {

View File

@ -79,7 +79,7 @@ if (!empty($update)) {
$object = new BookKeeping($db);
// Security check
if (empty($conf->accounting->enabled)) {
if (!isModEnabled('accounting')) {
accessforbidden();
}
if ($user->socid > 0) {

View File

@ -214,7 +214,7 @@ if (empty($listofformat[$formatexportset])) {
$error = 0;
if (empty($conf->accounting->enabled)) {
if (!isModEnabled('accounting')) {
accessforbidden();
}
if ($user->socid > 0) {

View File

@ -187,7 +187,7 @@ if ($search_date_end && empty($search_date_endyear)) {
$search_date_endday = $tmparray['mday'];
}
if (empty($conf->accounting->enabled)) {
if (!isModEnabled('accounting')) {
accessforbidden();
}
if ($user->socid > 0) {

View File

@ -863,14 +863,18 @@ class AccountingAccount extends CommonObject
if (!empty($buyer->code_compta_product)) {
$code_t = $buyer->code_compta_product;
$suggestedid = $accountingAccount['thirdparty'];
$suggestedaccountingaccountfor = 'thridparty';
$suggestedaccountingaccountfor = 'thirdparty';
}
}
// Manage Deposit
if ($factureDet->desc == "(DEPOSIT)" || $facture->type == $facture::TYPE_DEPOSIT) {
$accountdeposittoventilated = new self($this->db);
$result = $accountdeposittoventilated->fetch('', $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT, 1);
if ($type=='customer') {
$result = $accountdeposittoventilated->fetch('', $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT, 1);
} elseif ($type=='supplier') {
$result = $accountdeposittoventilated->fetch('', $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT, 1);
}
if ($result < 0) {
return -1;
}

View File

@ -281,7 +281,7 @@ class AccountingJournal extends CommonObject
}
$label_link = $this->code;
if ($withlabel) {
if ($withlabel && !empty($this->label)) {
$label_link .= ' - '.($nourl ? '<span class="opacitymedium">' : '').$langs->transnoentities($this->label).($nourl ? '</span>' : '');
}
@ -429,7 +429,7 @@ class AccountingJournal extends CommonObject
{
global $conf, $langs;
if (empty($conf->asset->enabled)) {
if (!isModEnabled('asset')) {
return array();
}
@ -867,7 +867,7 @@ class AccountingJournal extends CommonObject
}
}
//
// if (!$error_for_line && !empty($conf->asset->enabled) && $this->nature == 1 && $bookkeeping->fk_doc > 0) {
// if (!$error_for_line && isModEnabled('asset') && $this->nature == 1 && $bookkeeping->fk_doc > 0) {
// // Set last cumulative depreciation
// require_once DOL_DOCUMENT_ROOT . '/asset/class/asset.class.php';
// $asset = new Asset($this->db);

View File

@ -57,7 +57,7 @@ $search_date_end = dol_get_last_day($year_end, $month_end);
$year_current = $year_start;
// Security check
if (empty($conf->accounting->enabled)) {
if (!isModEnabled('accounting')) {
accessforbidden();
}
if ($user->socid > 0) {
@ -75,7 +75,7 @@ if (empty($user->rights->accounting->fiscalyear->write)) {
$now = dol_now();
if ($action == 'validate_movements_confirm' && !empty($user->rights->accounting->fiscalyear->write)) {
if ($action == 'validate_movements_confirm' && $user->hasRight('accounting', 'fiscalyear', 'write')) {
$date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int'));
$date_end = dol_mktime(23, 59, 59, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int'));

View File

@ -38,7 +38,7 @@ $codeventil = GETPOST('codeventil', 'int');
$id = GETPOST('id', 'int');
// Security check
if (empty($conf->accounting->enabled)) {
if (!isModEnabled('accounting')) {
accessforbidden();
}
if ($user->socid > 0) {

View File

@ -40,7 +40,7 @@ $validatemonth = GETPOST('validatemonth', 'int');
$validateyear = GETPOST('validateyear', 'int');
// Security check
if (empty($conf->accounting->enabled)) {
if (!isModEnabled('accounting')) {
accessforbidden();
}
if ($user->socid > 0) {
@ -77,7 +77,7 @@ $action = GETPOST('action', 'aZ09');
$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
// Security check
if (empty($conf->accounting->enabled)) {
if (!isModEnabled('accounting')) {
accessforbidden();
}
if ($user->socid > 0) {
@ -622,7 +622,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) { // This part of code looks strange
print '</div>';
if (!empty($conf->margin->enabled)) {
if (isModEnabled('margin')) {
print "<br>\n";
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';

View File

@ -85,7 +85,7 @@ if (!$sortorder) {
}
// Security check
if (empty($conf->accounting->enabled)) {
if (!isModEnabled('accounting')) {
accessforbidden();
}
if ($user->socid > 0) {

View File

@ -104,7 +104,7 @@ $accountingAccount = new AccountingAccount($db);
$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
// Security check
if (empty($conf->accounting->enabled)) {
if (!isModEnabled('accounting')) {
accessforbidden();
}
if ($user->socid > 0) {

View File

@ -42,7 +42,7 @@ $codeventil = GETPOST('codeventil', 'int');
$id = GETPOST('id', 'int');
// Security check
if (empty($conf->accounting->enabled)) {
if (!isModEnabled('accounting')) {
accessforbidden();
}
if ($user->socid > 0) {

View File

@ -58,7 +58,7 @@ $year_current = $year_start;
$action = GETPOST('action', 'aZ09');
// Security check
if (empty($conf->accounting->enabled)) {
if (!isModEnabled('accounting')) {
accessforbidden();
}
if ($user->socid > 0) {

View File

@ -79,7 +79,7 @@ if (!$sortorder) {
}
// Security check
if (empty($conf->accounting->enabled)) {
if (!isModEnabled('accounting')) {
accessforbidden();
}
if ($user->socid > 0) {

View File

@ -97,7 +97,7 @@ $accounting = new AccountingAccount($db);
$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
// Security check
if (empty($conf->accounting->enabled)) {
if (!isModEnabled('accounting')) {
accessforbidden();
}
if ($user->socid > 0) {

View File

@ -39,17 +39,17 @@ if ($user->socid > 0) {
accessforbidden();
}
/*
if (empty($conf->accounting->enabled)) {
if (!isModEnabled('accounting')) {
accessforbidden();
}
if (empty($user->rights->accounting->mouvements->lire)) {
accessforbidden();
}
*/
if (empty($conf->comptabilite->enabled) && empty($conf->accounting->enabled) && empty($conf->asset->enabled) && empty($conf->intracommreport->enabled)) {
if (!isModEnabled('comptabilite') && !isModEnabled('accounting') && !isModEnabled('asset') && !isModEnabled('intracommreport')) {
accessforbidden();
}
if (empty($user->hasRight('compta', 'resultat', 'lire')) && empty($user->hasRight('accounting', 'comptarapport', 'lire')) && empty($user->hasRight('accounting', 'mouvements', 'lire')) && empty($user->hasRight('asset', 'read')) && empty($user->hasRight('intracommreport', 'read'))) {
if (!$user->hasRight('compta', 'resultat', 'lire') && !$user->hasRight('accounting', 'comptarapport', 'lire') && !$user->hasRight('accounting', 'mouvements', 'lire') && !$user->hasRight('asset', 'read') && !$user->hasRight('intracommreport', 'read')) {
accessforbidden();
}
@ -86,7 +86,7 @@ if (!empty($conf->global->INVOICE_USE_SITUATION) && $conf->global->INVOICE_USE_S
print '<span class="opacitymedium">'.$langs->trans("SorryThisModuleIsNotCompatibleWithTheExperimentalFeatureOfSituationInvoices")."</span>\n";
print "<br>";
} elseif (!empty($conf->accounting->enabled)) {
} elseif (isModEnabled('accounting')) {
$step = 0;
$resultboxes = FormOther::getBoxesArea($user, "27"); // Load $resultboxes (selectboxlist + boxactivated + boxlista + boxlistb)
@ -117,7 +117,7 @@ if (!empty($conf->global->INVOICE_USE_SITUATION) && $conf->global->INVOICE_USE_S
print '<div class="'.($helpisexpanded ? '' : 'hideobject').'" id="idfaq">'; // hideobject is to start hidden
print "<br>\n";
print '<span class="opacitymedium">'.$langs->trans("AccountancyAreaDescIntro")."</span><br>\n";
if (!empty($user->rights->accounting->chartofaccount)) {
if ($user->hasRight('accounting', 'chartofaccount')) {
print "<br>\n"; print "<br>\n";
print load_fiche_titre('<span class="fa fa-calendar-check-o"></span> '.$langs->trans("AccountancyAreaDescActionOnce"), '', '')."\n";
@ -165,7 +165,7 @@ if (!empty($conf->global->INVOICE_USE_SITUATION) && $conf->global->INVOICE_USE_S
print $s;
print "<br>\n";
if (!empty($conf->tax->enabled)) {
if (isModEnabled('tax')) {
$textlink = '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=7&from=accountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuTaxAccounts").'</strong></a>';
$step++;
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, '{s}');
@ -173,7 +173,7 @@ if (!empty($conf->global->INVOICE_USE_SITUATION) && $conf->global->INVOICE_USE_S
print $s;
print "<br>\n";
}
if (!empty($conf->expensereport->enabled)) { // TODO Move this in the default account page because this is only one accounting account per purpose, not several.
if (isModEnabled('expensereport')) { // TODO Move this in the default account page because this is only one accounting account per purpose, not several.
$step++;
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, '{s}');
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=17&from=accountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuExpenseReportAccounts").'</strong></a>', $s);
@ -212,7 +212,7 @@ if (!empty($conf->global->INVOICE_USE_SITUATION) && $conf->global->INVOICE_USE_S
print $s;
print "<br>\n";
if (!empty($conf->expensereport->enabled) || !empty($conf->deplacement->enabled)) {
if (isModEnabled('expensereport')|| isModEnabled('deplacement')) {
$step++;
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("ExpenseReports"), '{s}')."\n";
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/expensereport/index.php"><strong>'.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("ExpenseReportsVentilation").'</strong></a>', $s);

View File

@ -83,7 +83,7 @@ $now = dol_now();
$action = GETPOST('action', 'aZ09');
// Security check
if (empty($conf->accounting->enabled)) {
if (!isModEnabled('accounting')) {
accessforbidden();
}
if ($user->socid > 0) {

View File

@ -58,7 +58,7 @@ if ($in_bookkeeping == '') {
$now = dol_now();
// Security check
if (empty($conf->accounting->enabled)) {
if (!isModEnabled('accounting')) {
accessforbidden();
}
if ($user->socid > 0) {

View File

@ -61,7 +61,7 @@ $hookmanager->initHooks(array('purchasesjournal'));
$parameters = array();
// Security check
if (empty($conf->accounting->enabled)) {
if (!isModEnabled('accounting')) {
accessforbidden();
}
if ($user->socid > 0) {
@ -405,8 +405,18 @@ if ($action == 'writebookkeeping') {
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
$bookkeeping->thirdparty_code = $companystatic->code_fournisseur;
$bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = '';
if (!empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT)) {
if ($k == getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT')) {
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
} else {
$bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = '';
}
} else {
$bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = '';
}
$bookkeeping->numero_compte = $k;
$bookkeeping->label_compte = $label_account;
@ -952,6 +962,13 @@ if (empty($action) || $action == 'view') {
print "</td>";
// Subledger account
print "<td>";
if (!empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT)) {
if ($k == getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT')) {
print length_accounta($tabcompany[$key]['code_compta']);
}
} elseif (($accountoshow == "") || $accountoshow == 'NotDefined') {
print '<span class="error">' . $langs->trans("ThirdpartyAccountNotDefined") . '</span>';
}
print '</td>';
$companystatic->id = $tabcompany[$key]['id'];
$companystatic->name = $tabcompany[$key]['name'];

View File

@ -63,7 +63,7 @@ $hookmanager->initHooks(array('sellsjournal'));
$parameters = array();
// Security check
if (empty($conf->accounting->enabled)) {
if (!isModEnabled('accounting')) {
accessforbidden();
}
if ($user->socid > 0) {

View File

@ -83,7 +83,7 @@ if (!is_array($journal_data)) {
}
// Security check
if (empty($conf->accounting->enabled)) {
if (!isModEnabled('accounting')) {
accessforbidden();
}
if ($user->socid > 0) {

View File

@ -42,7 +42,7 @@ $codeventil = GETPOST('codeventil', 'int');
$id = GETPOST('id', 'int');
// Security check
if (empty($conf->accounting->enabled)) {
if (!isModEnabled('accounting')) {
accessforbidden();
}
if ($user->socid > 0) {

View File

@ -89,7 +89,7 @@ if (!$sortorder) {
$formaccounting = new FormAccounting($db);
// Security check
if (empty($conf->accounting->enabled)) {
if (!isModEnabled('accounting')) {
accessforbidden();
}
if ($user->socid > 0) {

View File

@ -106,7 +106,7 @@ $accountingAccount = new AccountingAccount($db);
$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
// Security check
if (empty($conf->accounting->enabled)) {
if (!isModEnabled('accounting')) {
accessforbidden();
}
if ($user->socid > 0) {

View File

@ -130,7 +130,7 @@ if ($object->id > 0) {
llxHeader("", $title, $help_url);
if (!empty($conf->notification->enabled)) {
if (isModEnabled('notification')) {
$langs->load("mails");
}
$head = member_prepare_head($object);

View File

@ -179,7 +179,7 @@ abstract class ActionsAdherentCardCommon
if ($action == 'view' || $action == 'edit' || $action == 'delete') {
// Emailing
if (!empty($conf->mailing->enabled)) {
if (isModEnabled('mailing')) {
$langs->load("mails");
$this->tpl['nb_emailing'] = $this->object->getNbOfEMailings();
}

View File

@ -58,7 +58,7 @@ $userid = GETPOST('userid', 'int');
$socid = GETPOST('socid', 'int');
$ref = GETPOST('ref', 'alpha');
if (!empty($conf->mailmanspip->enabled)) {
if (isModEnabled('mailmanspip')) {
include_once DOL_DOCUMENT_ROOT.'/mailmanspip/class/mailmanspip.class.php';
$langs->load('mailmanspip');
@ -278,7 +278,7 @@ if (empty($reshook)) {
}
// Create new object
if ($result > 0 && !$error) {
$object->oldcopy = clone $object;
$object->oldcopy = dol_clone($object);
// Change values
$object->civility_id = trim(GETPOST("civility_id", 'alphanohtml'));
@ -475,7 +475,7 @@ if (empty($reshook)) {
$object->phone_perso = $phone_perso;
$object->phone_mobile = $phone_mobile;
$object->socialnetworks = array();
if (!empty($conf->socialnetworks->enabled)) {
if (isModEnabled('socialnetworks')) {
foreach ($socialnetworks as $key => $value) {
if (GETPOSTISSET($key) && GETPOST($key, 'alphanohtml') != '') {
$object->socialnetworks[$key] = GETPOST("member_".$key, 'alphanohtml');
@ -582,36 +582,15 @@ if (empty($reshook)) {
$id = $object->id;
} else {
$db->rollback();
if ($object->error) {
setEventMessages($object->error, $object->errors, 'errors');
} else {
setEventMessages($object->error, $object->errors, 'errors');
}
setEventMessages($object->error, $object->errors, 'errors');
}
// Auto-create thirdparty on member creation
if (!empty($conf->global->ADHERENT_DEFAULT_CREATE_THIRDPARTY)) {
if ($result > 0) {
// User creation
// Create third party out of a member
$company = new Societe($db);
$companyalias = '';
$fullname = $object->getFullName($langs);
if ($object->morphy == 'mor') {
$companyname = $object->company;
if (!empty($fullname)) {
$companyalias = $fullname;
}
} else {
$companyname = $fullname;
if (!empty($object->company)) {
$companyalias = $object->company;
}
}
$result = $company->create_from_member($object, $companyname, $companyalias);
$result = $company->create_from_member($object);
if ($result < 0) {
$langs->load("errors");
setEventMessages($langs->trans($company->error), null, 'errors');
@ -1110,7 +1089,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '<tr><td>'.$langs->trans("PhoneMobile").'</td>';
print '<td>'.img_picto('', 'object_phoning_mobile', 'class="pictofixedwidth"').'<input type="text" name="phone_mobile" size="20" value="'.(GETPOSTISSET('phone_mobile') ? GETPOST('phone_mobile', 'alpha') : $object->phone_mobile).'"></td></tr>';
if (!empty($conf->socialnetworks->enabled)) {
if (isModEnabled('socialnetworks')) {
foreach ($socialnetworks as $key => $value) {
if (!$value['active']) {
break;
@ -1131,7 +1110,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print "</td></tr>\n";
// Categories
if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) {
if (isModEnabled('categorie') && !empty($user->rights->categorie->lire)) {
print '<tr><td>'.$form->editfieldkey("Categories", 'memcats', '', $object, 0).'</td><td>';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_MEMBER, null, 'parent', null, null, 1);
print img_picto('', 'category').$form->multiselectarray('memcats', $cate_arbo, GETPOST('memcats', 'array'), null, null, 'quatrevingtpercent widthcentpercentminusx', 0, 0);
@ -1352,7 +1331,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '<tr><td>'.$langs->trans("PhoneMobile").'</td>';
print '<td>'.img_picto('', 'object_phoning_mobile', 'class="pictofixedwidth"').'<input type="text" name="phone_mobile" value="'.(GETPOSTISSET("phone_mobile") ? GETPOST("phone_mobile") : $object->phone_mobile).'"></td></tr>';
if (!empty($conf->socialnetworks->enabled)) {
if (isModEnabled('socialnetworks')) {
foreach ($socialnetworks as $key => $value) {
if (!$value['active']) {
break;
@ -1380,7 +1359,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print "</td></tr>\n";
// Categories
if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) {
if (isModEnabled('categorie') && !empty($user->rights->categorie->lire)) {
print '<tr><td>'.$form->editfieldkey("Categories", 'memcats', '', $object, 0).'</td>';
print '<td>';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_MEMBER, null, null, null, null, 1);
@ -1397,7 +1376,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
}
// Third party Dolibarr
if (!empty($conf->societe->enabled)) {
if (isModEnabled('societe')) {
print '<tr><td>'.$langs->trans("LinkedToDolibarrThirdParty").'</td><td colspan="2" class="valeur">';
if ($object->socid) {
$company = new Societe($db);
@ -1470,12 +1449,12 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
$formquestion = array(
array('label' => $langs->trans("LoginToCreate"), 'type' => 'text', 'name' => 'login', 'value' => $login)
);
if (!empty($conf->societe->enabled) && $object->socid > 0) {
if (isModEnabled('societe') && $object->socid > 0) {
$object->fetch_thirdparty();
$formquestion[] = array('label' => $langs->trans("UserWillBe"), 'type' => 'radio', 'name' => 'internalorexternal', 'default'=>'external', 'values' => array('external'=>$langs->trans("External").' - '.$langs->trans("LinkedToDolibarrThirdParty").' '.$object->thirdparty->getNomUrl(1, '', 0, 1), 'internal'=>$langs->trans("Internal")));
}
$text = '';
if (!empty($conf->societe->enabled) && $object->socid <= 0) {
if (isModEnabled('societe') && $object->socid <= 0) {
$text .= $langs->trans("UserWillBeInternalUser").'<br>';
}
$text .= $langs->trans("ConfirmCreateLogin");
@ -1560,12 +1539,12 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// Create form popup
$formquestion = array();
if ($object->email) {
$formquestion[] = array('type' => 'checkbox', 'name' => 'send_mail', 'label' => $label, 'value' => ($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL ?true:false));
$formquestion[] = array('type' => 'checkbox', 'name' => 'send_mail', 'label' => $label, 'value' => (getDolGlobalString('ADHERENT_DEFAULT_SENDINFOBYMAIL') ? true : false));
}
if (!empty($conf->mailman->enabled) && !empty($conf->global->ADHERENT_USE_MAILMAN)) {
if (isModEnabled('mailman') && !empty($conf->global->ADHERENT_USE_MAILMAN)) {
$formquestion[] = array('type'=>'other', 'label'=>$langs->transnoentitiesnoconv("SynchroMailManEnabled"), 'value'=>'');
}
if (!empty($conf->mailman->enabled) && !empty($conf->global->ADHERENT_USE_SPIP)) {
if (isModEnabled('mailman') && !empty($conf->global->ADHERENT_USE_SPIP)) {
$formquestion[] = array('type'=>'other', 'label'=>$langs->transnoentitiesnoconv("SynchroSpipEnabled"), 'value'=>'');
}
print $form->formconfirm("card.php?rowid=".$id, $langs->trans("ValidateMember"), $langs->trans("ConfirmValidateMember"), "confirm_valid", $formquestion, 'yes', 1, 220);
@ -1591,7 +1570,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_CANCELATION;
$labeltouse = getDolGlobalString('ADHERENT_EMAIL_TEMPLATE_CANCELATION');
if (!empty($labeltouse)) {
$arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse);
@ -1713,7 +1692,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
$rowspan++;
}
if (!empty($conf->societe->enabled)) {
if (isModEnabled('societe')) {
$rowspan++;
}
@ -1804,7 +1783,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '<table class="border tableforfield centpercent">';
// Tags / Categories
if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) {
if (isModEnabled('categorie') && !empty($user->rights->categorie->lire)) {
print '<tr><td>'.$langs->trans("Categories").'</td>';
print '<td colspan="2">';
print $form->showCategories($object->id, Categorie::TYPE_MEMBER, 1);
@ -1834,7 +1813,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
// Third party Dolibarr
if (!empty($conf->societe->enabled)) {
if (isModEnabled('societe')) {
print '<tr><td>';
$editenable = $user->rights->adherent->creer;
print $form->editfieldkey('LinkedToDolibarrThirdParty', 'thirdparty', '', $object, $editenable);
@ -1972,7 +1951,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
}
// Create third party
if (!empty($conf->societe->enabled) && !$object->socid) {
if (isModEnabled('societe') && !$object->socid) {
if ($user->rights->societe->creer) {
if (Adherent::STATUS_DRAFT != $object->statut) {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'&amp;action=create_thirdparty" title="'.dol_escape_htmltag($langs->trans("CreateDolibarrThirdPartyDesc")).'">'.$langs->trans("CreateDolibarrThirdParty").'</a>'."\n";
@ -1998,7 +1977,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
}
// Action SPIP
if (!empty($conf->mailmanspip->enabled) && !empty($conf->global->ADHERENT_USE_SPIP)) {
if (isModEnabled('mailmanspip') && !empty($conf->global->ADHERENT_USE_SPIP)) {
$isinspip = $mailmanspip->is_in_spip($object);
if ($isinspip == 1) {
@ -2055,7 +2034,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
*/
// Show online payment link
$useonlinepayment = (!empty($conf->paypal->enabled) || !empty($conf->stripe->enabled) || !empty($conf->paybox->enabled));
$useonlinepayment = (isModEnabled('paypal') || isModEnabled('stripe') || isModEnabled('paybox'));
if ($useonlinepayment) {
print '<br>';

View File

@ -972,10 +972,10 @@ class Adherent extends CommonObject
}
/**
* Fonction qui supprime l'adherent et les donnees associees
* Fonction to delete a member and its data
*
* @param int $rowid Id of member to delete
* @param User $user User object
* @param User $user User object
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 if KO, 0=nothing to do, >0 if OK
*/
@ -1826,7 +1826,7 @@ class Adherent extends CommonObject
if (!$error) {
// Create payment line for invoice
$paiement_id = $paiement->create($user);
if (!$paiement_id > 0) {
if (!($paiement_id > 0)) {
$this->error = $paiement->error;
$this->errors = $paiement->errors;
$error++;

View File

@ -440,6 +440,7 @@ class AdherentType extends CommonObject
/**
* Function to delete the member's status
* TODO Add param "User $user"
*
* @return int > 0 if OK, 0 if not found, < 0 if KO
*/

View File

@ -128,7 +128,7 @@ if ($id > 0) {
$totalsize += $file['size'];
}
if (!empty($conf->notification->enabled)) {
if (isModEnabled('notification')) {
$langs->load("mails");
}

View File

@ -33,7 +33,7 @@ $sortfield = GETPOST('sortfield', 'alphanohtml');
$sortorder = GETPOST('sortorder', 'aZ09');
// Security check
if (empty($conf->adherent->enabled)) {
if (!isModEnabled('adherent')) {
accessforbidden();
}
if (empty($user->rights->adherent->export)) {

View File

@ -659,7 +659,7 @@ if ($sall) {
// Filter on categories
$moreforfilter = '';
if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) {
if (isModEnabled('categorie') && $user->rights->categorie->lire) {
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= img_picto($langs->trans('Categories'), 'category', 'class="pictofixedlength"').$formother->select_categories(Categorie::TYPE_MEMBER, $search_categ, 'search_categ', 1);

View File

@ -88,7 +88,7 @@ $upload_dir = $conf->partnership->multidir_output[isset($object->entity) ? $o
if (getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR') != 'member') {
accessforbidden('Partnership module is not activated for members');
}
if (empty($conf->partnership->enabled)) {
if (!isModEnabled('partnership')) {
accessforbidden();
}
if (empty($permissiontoread)) {
@ -151,7 +151,7 @@ if ($id > 0) {
$object = new Adherent($db);
$result = $object->fetch($id);
if (!empty($conf->notification->enabled)) {
if (isModEnabled('notification')) {
$langs->load("mails");
}

View File

@ -271,7 +271,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
$action = 'addsubscription';
} else {
// If an amount has been provided, we check also fields that becomes mandatory when amount is not null.
if (!empty($conf->banque->enabled) && GETPOST("paymentsave") != 'none') {
if (isModEnabled('banque') && GETPOST("paymentsave") != 'none') {
if (GETPOST("subscription")) {
if (!GETPOST("label")) {
$errmsg = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Label"));
@ -475,7 +475,7 @@ if ($rowid > 0) {
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
$rowspan++;
}
if (!empty($conf->societe->enabled)) {
if (isModEnabled('societe')) {
$rowspan++;
}
@ -571,7 +571,7 @@ if ($rowid > 0) {
print '<table class="border tableforfield centpercent">';
// Tags / Categories
if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) {
if (isModEnabled('categorie') && !empty($user->rights->categorie->lire)) {
print '<tr><td>'.$langs->trans("Categories").'</td>';
print '<td colspan="2">';
print $form->showCategories($object->id, Categorie::TYPE_MEMBER, 1);
@ -589,7 +589,7 @@ if ($rowid > 0) {
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
// Third party Dolibarr
if (!empty($conf->societe->enabled)) {
if (isModEnabled('societe')) {
print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans("LinkedToDolibarrThirdParty");
@ -718,7 +718,7 @@ if ($rowid > 0) {
print_liste_field_titre('DateStart', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre('DateEnd', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre('Amount', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right ');
if (!empty($conf->banque->enabled)) {
if (isModEnabled('banque')) {
print_liste_field_titre('Account', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right ');
}
print "</tr>\n";
@ -753,7 +753,7 @@ if ($rowid > 0) {
print '<td class="center">'.dol_print_date($db->jdate($objp->dateh), 'day')."</td>\n";
print '<td class="center">'.dol_print_date($db->jdate($objp->datef), 'day')."</td>\n";
print '<td class="right">'.price($objp->subscription).'</td>';
if (!empty($conf->banque->enabled)) {
if (isModEnabled('banque')) {
print '<td class="right">';
if ($objp->bid) {
$accountstatic->label = $objp->label;
@ -762,7 +762,7 @@ if ($rowid > 0) {
$accountstatic->account_number = $objp->account_number;
$accountstatic->currency_code = $objp->currency_code;
if (!empty($conf->accounting->enabled) && $objp->fk_accountancy_journal > 0) {
if (isModEnabled('accounting') && $objp->fk_accountancy_journal > 0) {
$accountingjournal = new AccountingJournal($db);
$accountingjournal->fetch($objp->fk_accountancy_journal);
@ -782,7 +782,7 @@ if ($rowid > 0) {
if (empty($num)) {
$colspan = 6;
if (!empty($conf->banque->enabled)) {
if (isModEnabled('banque')) {
$colspan++;
}
print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>';
@ -797,7 +797,7 @@ if ($rowid > 0) {
if (($action != 'addsubscription' && $action != 'create_thirdparty')) {
// Shon online payment link
$useonlinepayment = (!empty($conf->paypal->enabled) || !empty($conf->stripe->enabled) || !empty($conf->paybox->enabled));
$useonlinepayment = (isModEnabled('paypal') || isModEnabled('stripe') || isModEnabled('paybox'));
if ($useonlinepayment) {
print '<br>';
@ -831,11 +831,11 @@ if ($rowid > 0) {
$bankviainvoice = 1;
}
} else {
if (!empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE == 'bankviainvoice' && !empty($conf->banque->enabled) && !empty($conf->societe->enabled) && isModEnabled('facture')) {
if (!empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE == 'bankviainvoice' && isModEnabled('banque') && isModEnabled('societe') && isModEnabled('facture')) {
$bankviainvoice = 1;
} elseif (!empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE == 'bankdirect' && !empty($conf->banque->enabled)) {
} elseif (!empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE == 'bankdirect' && isModEnabled('banque')) {
$bankdirect = 1;
} elseif (!empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE == 'invoiceonly' && !empty($conf->banque->enabled) && !empty($conf->societe->enabled) && isModEnabled('facture')) {
} elseif (!empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE == 'invoiceonly' && isModEnabled('banque') && isModEnabled('societe') && isModEnabled('facture')) {
$invoiceonly = 1;
}
}
@ -982,7 +982,7 @@ if ($rowid > 0) {
print '"></td></tr>';
// Complementary action
if ((!empty($conf->banque->enabled) || isModEnabled('facture')) && empty($conf->global->ADHERENT_SUBSCRIPTION_HIDECOMPLEMENTARYACTIONS)) {
if ((isModEnabled('banque') || isModEnabled('facture')) && empty($conf->global->ADHERENT_SUBSCRIPTION_HIDECOMPLEMENTARYACTIONS)) {
$company = new Societe($db);
if ($object->fk_soc) {
$result = $company->fetch($object->fk_soc);
@ -998,12 +998,12 @@ if ($rowid > 0) {
print '<input type="radio" class="moreaction" id="none" name="paymentsave" value="none"'.(empty($bankdirect) && empty($invoiceonly) && empty($bankviainvoice) ? ' checked' : '').'>';
print '<label for="none"> '.$langs->trans("None").'</label><br>';
// Add entry into bank accoun
if (!empty($conf->banque->enabled)) {
if (isModEnabled('banque')) {
print '<input type="radio" class="moreaction" id="bankdirect" name="paymentsave" value="bankdirect"'.(!empty($bankdirect) ? ' checked' : '');
print '><label for="bankdirect"> '.$langs->trans("MoreActionBankDirect").'</label><br>';
}
// Add invoice with no payments
if (!empty($conf->societe->enabled) && isModEnabled('facture')) {
if (isModEnabled('societe') && isModEnabled('facture')) {
print '<input type="radio" class="moreaction" id="invoiceonly" name="paymentsave" value="invoiceonly"'.(!empty($invoiceonly) ? ' checked' : '');
//if (empty($object->fk_soc)) print ' disabled';
print '><label for="invoiceonly"> '.$langs->trans("MoreActionInvoiceOnly");
@ -1022,7 +1022,7 @@ if ($rowid > 0) {
if (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) || $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS != 'defaultforfoundationcountry') {
print '. <span class="opacitymedium">'.$langs->trans("NoVatOnSubscription", 0).'</span>';
}
if (!empty($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS) && (!empty($conf->product->enabled) || !empty($conf->service->enabled))) {
if (!empty($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS) && (isModEnabled('product') || isModEnabled('service'))) {
$prodtmp = new Product($db);
$result = $prodtmp->fetch($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS);
if ($result < 0) {
@ -1033,7 +1033,7 @@ if ($rowid > 0) {
print '</label><br>';
}
// Add invoice with payments
if (!empty($conf->banque->enabled) && !empty($conf->societe->enabled) && isModEnabled('facture')) {
if (isModEnabled('banque') && isModEnabled('societe') && isModEnabled('facture')) {
print '<input type="radio" class="moreaction" id="bankviainvoice" name="paymentsave" value="bankviainvoice"'.(!empty($bankviainvoice) ? ' checked' : '');
//if (empty($object->fk_soc)) print ' disabled';
print '><label for="bankviainvoice"> '.$langs->trans("MoreActionBankViaInvoice");
@ -1052,7 +1052,7 @@ if ($rowid > 0) {
if (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) || $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS != 'defaultforfoundationcountry') {
print '. <span class="opacitymedium">'.$langs->trans("NoVatOnSubscription", 0).'</span>';
}
if (!empty($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS) && (!empty($conf->product->enabled) || !empty($conf->service->enabled))) {
if (!empty($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS) && (isModEnabled('product')|| isModEnabled('service'))) {
$prodtmp = new Product($db);
$result = $prodtmp->fetch($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS);
if ($result < 0) {

View File

@ -89,7 +89,7 @@ $arrayfields = array(
'd.firstname'=>array('label'=>"Firstname", 'checked'=>1),
'd.login'=>array('label'=>"Login", 'checked'=>1),
't.libelle'=>array('label'=>"Label", 'checked'=>1),
'd.bank'=>array('label'=>"BankAccount", 'checked'=>1, 'enabled'=>(!empty($conf->banque->enabled))),
'd.bank'=>array('label'=>"BankAccount", 'checked'=>1, 'enabled'=>(isModEnabled('banque'))),
/*'d.note_public'=>array('label'=>"NotePublic", 'checked'=>0),
'd.note_private'=>array('label'=>"NotePrivate", 'checked'=>0),*/
'c.dateadh'=>array('label'=>"DateSubscription", 'checked'=>1, 'position'=>100),

View File

@ -41,6 +41,7 @@ $langs->load("members");
$rowid = GETPOST('rowid', 'int');
$action = GETPOST('action', 'aZ09');
$cancel = GETPOST('cancel', 'alpha');
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)).basename(__FILE__, '.php')); // To manage different context of search
$backtopage = GETPOST('backtopage', 'alpha');
$sall = GETPOST("sall", "alpha");
@ -170,7 +171,8 @@ if ($action == 'add' && $user->rights->adherent->configurer) {
if ($action == 'update' && $user->rights->adherent->configurer) {
$object->fetch($rowid);
$object->oldcopy = clone $object;
$object->oldcopy = dol_clone($object);
$object->label= trim($label);
$object->morphy = trim($morphy);
$object->status = (int) $status;
@ -201,7 +203,7 @@ if ($action == 'update' && $user->rights->adherent->configurer) {
exit;
}
if ($action == 'confirm_delete' && $user->rights->adherent->configurer) {
if ($action == 'confirm_delete' && !empty($user->rights->adherent->configurer)) {
$object->fetch($rowid);
$res = $object->delete();
@ -447,7 +449,7 @@ if ($rowid > 0) {
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">';
print '<table class="tableforfield border centpercent">';
// Morphy
print '<tr><td>'.$langs->trans("MembersNature").'</td><td class="valeur" >'.$object->getmorphylib($object->morphy).'</td>';
@ -681,20 +683,23 @@ if ($rowid > 0) {
print_liste_field_titre("Action", $_SERVER["PHP_SELF"], "", $param, "", 'width="60" align="center"', $sortfield, $sortorder);
print "</tr>\n";
while ($i < $num && $i < $conf->liste_limit) {
$adh = new Adherent($db);
$imaxinloop = ($limit ? min($num, $limit) : $num);
while ($i < $imaxinloop) {
$objp = $db->fetch_object($resql);
$datefin = $db->jdate($objp->datefin);
$adh = new Adherent($db);
$adh->lastname = $objp->lastname;
$adh->firstname = $objp->firstname;
$adh->datefin = $datefin;
$adh->need_subscription = $objp->subscription;
$adh->statut = $objp->status;
// Lastname
print '<tr class="oddeven">';
// Lastname
if ($objp->company != '') {
print '<td><a href="card.php?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowMember"), "user", 'class="paddingright"').$adh->getFullName($langs, 0, -1, 20).' / '.dol_trunc($objp->company, 12).'</a></td>'."\n";
} else {
@ -702,7 +707,7 @@ if ($rowid > 0) {
}
// Login
print "<td>".$objp->login."</td>\n";
print "<td>".dol_escape_htmltag($objp->login)."</td>\n";
// Type
/*print '<td class="nowrap">';
@ -759,11 +764,15 @@ if ($rowid > 0) {
$i++;
}
if ($i == 0) {
print '<tr><td colspan="7"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>';
}
print "</table>\n";
print '</div>';
print '</form>';
if ($num > $conf->liste_limit) {
if ($num > $limit) {
print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, '');
}
} else {

View File

@ -34,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
// Load translation files required by the page
$langs->loadLangs(array('members', 'languages'));
$id = GETPOST('rowid', 'int');
$id = GETPOST('rowid', 'int') ? GETPOST('rowid', 'int') : GETPOST('id', 'int');
$action = GETPOST('action', 'aZ09');
$cancel = GETPOST('cancel', 'alpha');
$ref = GETPOST('ref', 'alphanohtml');
@ -61,7 +61,12 @@ if ($cancel == $langs->trans("Cancel")) {
if ($action == 'delete' && GETPOST('langtodelete', 'alpha')) {
$object = new AdherentType($db);
$object->fetch($id);
$object->delMultiLangs(GETPOST('langtodelete', 'alpha'), $user);
$result = $object->delMultiLangs(GETPOST('langtodelete', 'alpha'), $user);
if ($result > 0) {
setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
header("Location: ".$_SERVER["PHP_SELF"].'?id='.$id);
exit;
}
}
// Add translation

View File

@ -184,7 +184,7 @@ if (!empty($triggers)) {
}
//print 'module='.$module.' code='.$trigger['code'].'<br>';
if (!empty($conf->$module->enabled)) {
if (isModEnabled('module')) {
// Discard special case: If option FICHINTER_CLASSIFY_BILLED is not set, we discard both trigger FICHINTER_CLASSIFY_BILLED and FICHINTER_CLASSIFY_UNBILLED
if ($trigger['code'] == 'FICHINTER_CLASSIFY_BILLED' && empty($conf->global->FICHINTER_CLASSIFY_BILLED)) {
continue;

View File

@ -66,7 +66,7 @@ if (preg_match('/set_(.*)/', $action, $reg)) {
$value = (GETPOST($code) ? GETPOST($code) : 1);
$res = dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity);
if (!$res > 0) {
if (!($res > 0)) {
$error++;
$errors[] = $db->lasterror();
}
@ -86,7 +86,7 @@ if (preg_match('/set_(.*)/', $action, $reg)) {
$code = $reg[1];
$res = dolibarr_del_const($db, $code, $conf->entity);
if (!$res > 0) {
if (!($res > 0)) {
$error++;
$errors[] = $db->lasterror();
}

View File

@ -206,7 +206,7 @@ $job->fetch(0, 'ActionComm', 'sendEmailsReminder');
// AGENDA REMINDER EMAIL
print '<tr class="oddeven">'."\n";
print '<td>'.$langs->trans('AGENDA_REMINDER_EMAIL', $langs->transnoentities("Module2300Name"));
if (!empty($conf->cron->enabled)) {
if (isModEnabled('cron')) {
if (!empty($conf->global->AGENDA_REMINDER_EMAIL)) {
if ($job->id > 0) {
if ($job->status == $job::STATUS_ENABLED) {
@ -219,7 +219,7 @@ print '</td>'."\n";
print '<td class="center">&nbsp;</td>'."\n";
print '<td class="right nowraponall">'."\n";
if (empty($conf->cron->enabled)) {
if (!isModEnabled('cron')) {
print '<span class="opacitymedium">'.$langs->trans("WarningModuleNotActive", $langs->transnoentitiesnoconv("Module2300Name")).'</span>';
} else {
if (empty($conf->global->AGENDA_REMINDER_EMAIL)) {

View File

@ -190,7 +190,7 @@ foreach ($dirbarcode as $reldir) {
// Select barcode numbering module
if ($conf->product->enabled) {
if (isModEnabled('product')) {
print load_fiche_titre($langs->trans("BarCodeNumberManager")." (".$langs->trans("Product").")", '', '');
print '<div class="div-table-responsive-no-min">';
@ -252,7 +252,7 @@ if ($conf->product->enabled) {
}
// Select barcode numbering module
if ($conf->societe->enabled) {
if (isModEnabled('societe')) {
print load_fiche_titre($langs->trans("BarCodeNumberManager")." (".$langs->trans("ThirdParty").")", '', '');
print '<div class="div-table-responsive-no-min">';
@ -450,7 +450,7 @@ if (!isset($_SERVER['WINDIR'])) {
}
// Module products
if (!empty($conf->product->enabled)) {
if (isModEnabled('product')) {
print '<tr class="oddeven">';
print '<td>'.$langs->trans("SetDefaultBarcodeTypeProducts").'</td>';
print '<td width="60" class="right">';
@ -461,7 +461,7 @@ if (!empty($conf->product->enabled)) {
}
// Module thirdparty
if (!empty($conf->societe->enabled)) {
if (isModEnabled('societe')) {
print '<tr class="oddeven">';
print '<td>'.$langs->trans("SetDefaultBarcodeTypeThirdParties").'</td>';
print '<td width="60" class="right">';

View File

@ -466,7 +466,7 @@ print '<input class="maxwidth300 widthcentpercentminusx" name="web" id="web" val
print '</td></tr>'."\n";
// Barcode
if (!empty($conf->barcode->enabled)) {
if (isModEnabled('barcode')) {
print '<tr class="oddeven"><td>';
print '<label for="barcode">'.$langs->trans("Gencod").'</label></td><td>';
print '<span class="fa fa-barcode pictofixedwidth"></span>';

View File

@ -44,7 +44,7 @@ $action = GETPOST('action', 'aZ09');
*/
// Shipment note
if (!empty($conf->expedition->enabled) && empty($conf->global->MAIN_SUBMODULE_EXPEDITION)) {
if (isModEnabled('expedition') && empty($conf->global->MAIN_SUBMODULE_EXPEDITION)) {
// This option should always be set to on when module is on.
dolibarr_set_const($db, "MAIN_SUBMODULE_EXPEDITION", "1", 'chaine', 0, '', $conf->entity);
}

View File

@ -142,7 +142,7 @@ if ($action == 'updateMask') {
$value = GETPOST('activate_hideClosedServiceByDefault', 'alpha');
$res3 = dolibarr_set_const($db, "CONTRACT_HIDE_CLOSED_SERVICES_BY_DEFAULT", $value, 'chaine', 0, '', $conf->entity);
if (!$res1 > 0 || !$res2 > 0 || !$res3 > 0) {
if (!($res1 > 0) || !($res2 > 0) || !($res3 > 0)) {
$error++;
}

View File

@ -90,12 +90,12 @@ print '<input type="hidden" name="action" value="set">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td>';
print '<td class="right"><input type="submit" class="button button-edit" '.$option.' value="'.$langs->trans("Modify").'"></td>';
print '<td class="right"><input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'"></td>';
print "</tr>\n";
print '<tr class="oddeven"><td class="nowrap">'.$langs->trans("DEBUGBAR_USE_LOG_FILE").'</td>';
print '<td>';
print $form->selectyesno('DEBUGBAR_USE_LOG_FILE', $conf->global->DEBUGBAR_USE_LOG_FILE, 1);
print $form->selectyesno('DEBUGBAR_USE_LOG_FILE', !empty($conf->global->DEBUGBAR_USE_LOG_FILE), 1);
print '</td><td>';
print '<span class="opacitymedium"> '.$langs->trans("UsingLogFileShowAllRecordOfSubrequestButIsSlower").'</span>';
print '</td></tr>';

View File

@ -91,9 +91,9 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be includ
//$isdraft = (($object->statut == MyObject::STATUS_DRAFT) ? 1 : 0);
//$result = restrictedArea($user, 'mymodule', $object->id, '', '', 'fk_soc', 'rowid', $isdraft);
$permissionnote = $user->rights->emailcollector->write; // Used by the include of actions_setnotes.inc.php
$permissiondellink = $user->rights->emailcollector->write; // Used by the include of actions_dellink.inc.php
$permissiontoadd = $user->rights->emailcollector->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
$permissionnote = $user->admin; // Used by the include of actions_setnotes.inc.php
$permissiondellink = $user->admin; // Used by the include of actions_dellink.inc.php
$permissiontoadd = $user->admin; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
$debuginfo = '';
@ -192,7 +192,7 @@ if ($action == 'updateoperation') {
$emailcollectoroperation = new EmailCollectorAction($db);
$emailcollectoroperation->fetch(GETPOST('rowidoperation2', 'int'));
$emailcollectoroperation->actionparam = GETPOST('operationparam2', 'restricthtml');
$emailcollectoroperation->actionparam = GETPOST('operationparam2', 'alphawithlgt');
if (in_array($emailcollectoroperation->type, array('loadthirdparty', 'loadandcreatethirdparty'))
&& empty($emailcollectoroperation->actionparam)) {
@ -337,14 +337,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Confirmation of action process
if ($action == 'collect') {
$formquestion = array(
'text' => $langs->trans("EmailCollectorConfirmCollect"),
);
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('EmailCollectorConfirmCollectTitle'), $text, 'confirm_collect', $formquestion, 0, 1, 220);
$formquestion = array();
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('EmailCollectorConfirmCollectTitle'), $langs->trans('EmailCollectorConfirmCollect'), 'confirm_collect', $formquestion, 0, 1, 220);
}
// Call Hook formConfirm
$parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid);
$parameters = array('formConfirm' => $formconfirm);
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if (empty($reshook)) {
$formconfirm .= $hookmanager->resPrint;
@ -620,12 +618,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '</td>';
print '<td class="wordbreak minwidth300 small">';
if ($action == 'editoperation' && $ruleaction['id'] == $operationid) {
print '<input type="text" class="quatrevingtquinzepercent" name="operationparam2" value="'.$ruleaction['actionparam'].'"><br>';
print '<input type="text" class="quatrevingtquinzepercent" name="operationparam2" value="'.dol_escape_htmltag($ruleaction['actionparam']).'"><br>';
print '<input type="hidden" name="rowidoperation2" value="'.$ruleaction['id'].'">';
print '<input type="submit" class="button small button-save" name="saveoperation2" value="'.$langs->trans("Save").'">';
print '<input type="submit" class="button small button-cancel" name="cancel" value="'.$langs->trans("Cancel").'">';
} else {
print $ruleaction['actionparam'];
print dol_escape_htmltag($ruleaction['actionparam']);
}
print '</td>';
// Move up/down
@ -679,7 +677,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&token='.newToken().'">'.$langs->trans("Edit").'</a></div>';
// Clone
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&token='.newToken().'&object=order">'.$langs->trans("ToClone").'</a></div>';
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=clone&token='.newToken().'&object=order">'.$langs->trans("ToClone").'</a></div>';
// Collect now
if (count($object->actions) > 0) {

View File

@ -142,7 +142,7 @@ $permissiontodelete = $user->admin;
if (!$user->admin) {
accessforbidden();
}
if (empty($conf->emailcollector->enabled)) {
if (!isModEnabled('emailcollector')) {
accessforbidden('Module not enabled');
}

View File

@ -228,14 +228,14 @@ if ($action == 'edit') {
if ($val['type'] == 'textarea') {
print '<textarea class="flat" name="'.$constname.'" id="'.$constname.'" cols="50" rows="5" wrap="soft">' . "\n";
print $conf->global->{$constname};
print getDolGlobalString($constname);
print "</textarea>\n";
} elseif ($val['type']== 'html') {
require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
$doleditor = new DolEditor($constname, $conf->global->{$constname}, '', 160, 'dolibarr_notes', '', false, false, $conf->fckeditor->enabled, ROWS_5, '90%');
$doleditor = new DolEditor($constname, getDolGlobalString($constname), '', 160, 'dolibarr_notes', '', false, false, $conf->fckeditor->enabled, ROWS_5, '90%');
$doleditor->Create();
} elseif ($val['type'] == 'yesno') {
print $form->selectyesno($constname, $conf->global->{$constname}, 1);
print $form->selectyesno($constname, getDolGlobalString($constname), 1);
} elseif (preg_match('/emailtemplate:/', $val['type'])) {
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
$formmail = new FormMail($db);
@ -255,7 +255,7 @@ if ($action == 'edit') {
$arrayofmessagename[$modelmail->id] = $langs->trans(preg_replace('/\(|\)/', '', $modelmail->label)) . $moreonlabel;
}
}
print $form->selectarray($constname, $arrayofmessagename, $conf->global->{$constname}, 'None', 0, 0, '', 0, 0, 0, '', '', 1);
print $form->selectarray($constname, $arrayofmessagename, getDolGlobalString($constname), 'None', 0, 0, '', 0, 0, 0, '', '', 1);
} elseif (preg_match('/category:/', $val['type'])) {
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
@ -263,13 +263,13 @@ if ($action == 'edit') {
$tmp = explode(':', $val['type']);
print img_picto('', 'category', 'class="pictofixedwidth"');
print $formother->select_categories($tmp[1], $conf->global->{$constname}, $constname, 0, $langs->trans('CustomersProspectsCategoriesShort'));
print $formother->select_categories($tmp[1], getDolGlobalString($constname), $constname, 0, $langs->trans('CustomersProspectsCategoriesShort'));
} elseif (preg_match('/thirdparty_type/', $val['type'])) {
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
$formcompany = new FormCompany($db);
print $formcompany->selectProspectCustomerType($conf->global->{$constname}, $constname, 'customerorprospect', 'form', '', 1);
print $formcompany->selectProspectCustomerType(getDolGlobalString($constname), $constname, 'customerorprospect', 'form', '', 1);
} elseif ($val['type'] == 'securekey') {
print '<input required="required" type="text" class="flat" id="'.$constname.'" name="'.$constname.'" value="'.(GETPOST($constname, 'alpha') ?GETPOST($constname, 'alpha') : $conf->global->{$constname}).'" size="40">';
print '<input type="text" class="flat" id="'.$constname.'" name="'.$constname.'" value="'.(GETPOST($constname, 'alpha') ?GETPOST($constname, 'alpha') : getDolGlobalString($constname)).'" size="40">';
if (!empty($conf->use_javascript_ajax)) {
print '&nbsp;'.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_token'.$constname.'" class="linkobject"');
}
@ -283,7 +283,7 @@ if ($action == 'edit') {
$form->select_produits($selected, $constname, '', 0);
}
} else {
print '<input name="' . $constname . '" class="flat ' . (empty($val['css']) ? 'minwidth200' : $val['css']) . '" value="' . $conf->global->{$constname} . '">';
print '<input name="' . $constname . '" class="flat ' . (empty($val['css']) ? 'minwidth200' : $val['css']) . '" value="' . getDolGlobalString($constname) . '">';
}
print '</td></tr>';
}
@ -309,28 +309,28 @@ if ($action == 'edit') {
print '</td><td>';
if ($val['type'] == 'textarea') {
print dol_nl2br($conf->global->{$constname});
print dol_nl2br(getDolGlobalString($constname));
} elseif ($val['type']== 'html') {
print $conf->global->{$constname};
print getDolGlobalString($constname);
} elseif ($val['type'] == 'yesno') {
print ajax_constantonoff($constname);
} elseif (preg_match('/emailtemplate:/', $val['type'])) {
if (!empty($conf->global->{$constname})) {
if (getDolGlobalString($constname)) {
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
$formmail = new FormMail($db);
$tmp = explode(':', $val['type']);
$template = $formmail->getEMailTemplate($db, $tmp[1], $user, $langs, $conf->global->{$constname});
$template = $formmail->getEMailTemplate($db, $tmp[1], $user, $langs, getDolGlobalString($constname));
if ($template < 0) {
setEventMessages(null, $formmail->errors, 'errors');
}
print $langs->trans($template->label);
}
} elseif (preg_match('/category:/', $val['type'])) {
if (!empty($conf->global->{$constname})) {
if (getDolGlobalString($constname)) {
$c = new Categorie($db);
$result = $c->fetch($conf->global->{$constname});
$result = $c->fetch(getDolGlobalString($constname));
if ($result < 0) {
setEventMessages(null, $c->errors, 'errors');
}
@ -342,25 +342,25 @@ if ($action == 'edit') {
print '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>';
}
} elseif (preg_match('/thirdparty_type/', $val['type'])) {
if ($conf->global->{$constname}==2) {
if (getDolGlobalString($constname)==2) {
print $langs->trans("Prospect");
} elseif ($conf->global->{$constname}==3) {
} elseif (getDolGlobalString($constname)==3) {
print $langs->trans("ProspectCustomer");
} elseif ($conf->global->{$constname}==1) {
} elseif (getDolGlobalString($constname)==1) {
print $langs->trans("Customer");
} elseif ($conf->global->{$constname}==0) {
} elseif (getDolGlobalString($constname)==0) {
print $langs->trans("NorProspectNorCustomer");
}
} elseif ($val['type'] == 'product') {
$product = new Product($db);
$resprod = $product->fetch($conf->global->{$constname});
$resprod = $product->fetch(getDolGlobalString($constname));
if ($resprod > 0) {
print $product->getNomUrl(1);
} elseif ($resprod < 0) {
setEventMessages(null, $object->errors, "errors");
setEventMessages($product->error, $product->errors, "errors");
}
} else {
print $conf->global->{$constname};
print getDolGlobalString($constname);
}
print '</td></tr>';
}

View File

@ -637,7 +637,7 @@ print "</tr>\n";
print '<tr class="oddeven">';
print "<td>".$langs->trans("SuggestPaymentByRIBOnAccount")."</td>";
print "<td>";
if (!empty($conf->banque->enabled)) {
if (isModEnabled('banque')) {
$sql = "SELECT rowid, label";
$sql .= " FROM ".MAIN_DB_PREFIX."bank_account";
$sql .= " WHERE clos = 0";

View File

@ -59,12 +59,12 @@ if ($action == 'set') {
if (!$error) {
$res1 = dolibarr_set_const($db, "GEOIP_VERSION", GETPOST('geoipversion', 'aZ09'), 'chaine', 0, '', $conf->entity);
if (!$res1 > 0) {
if (!($res1 > 0)) {
$error++;
}
$res2 = dolibarr_set_const($db, "GEOIPMAXMIND_COUNTRY_DATAFILE", $gimcdf, 'chaine', 0, '', $conf->entity);
if (!$res2 > 0) {
if (!($res2 > 0)) {
$error++;
}

View File

@ -141,7 +141,7 @@ if ($action == 'updateMask') {
$draft = GETPOST('HOLIDAY_DRAFT_WATERMARK', 'alpha');
$res2 = dolibarr_set_const($db, "HOLIDAY_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity);
if (!$res1 > 0 || !$res2 > 0) {
if (!($res1 > 0) || !($res2 > 0)) {
$error++;
}

View File

@ -178,63 +178,63 @@ $elementList = array();
$elementList['all'] = '-- '.dol_escape_htmltag($langs->trans("All")).' --';
$elementList['none'] = '-- '.dol_escape_htmltag($langs->trans("None")).' --';
$elementList['user'] = img_picto('', 'user', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToUser'));
$elementList['user'] = img_picto('', 'user', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToUser'));
if (!empty($conf->adherent->enabled) && !empty($user->rights->adherent->lire)) {
$elementList['member'] = img_picto('', 'object_member', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToMember'));
$elementList['member'] = img_picto('', 'object_member', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToMember'));
}
if (!empty($conf->recruitment->enabled) && !empty($user->rights->recruitment->recruitmentjobposition->read)) {
$elementList['recruitmentcandidature_send'] = img_picto('', 'recruitmentcandidature', 'class="paddingright"').dol_escape_htmltag($langs->trans('RecruitmentCandidatures'));
$elementList['recruitmentcandidature_send'] = img_picto('', 'recruitmentcandidature', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('RecruitmentCandidatures'));
}
if (!empty($conf->societe->enabled) && !empty($user->rights->societe->lire)) {
$elementList['thirdparty'] = img_picto('', 'company', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToThirdparty'));
$elementList['thirdparty'] = img_picto('', 'company', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToThirdparty'));
}
if (!empty($conf->project->enabled)) {
$elementList['project'] = img_picto('', 'project', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToProject'));
$elementList['project'] = img_picto('', 'project', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToProject'));
}
if (!empty($conf->propal->enabled) && !empty($user->rights->propal->lire)) {
$elementList['propal_send'] = img_picto('', 'propal', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendProposal'));
$elementList['propal_send'] = img_picto('', 'propal', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendProposal'));
}
if (!empty($conf->commande->enabled) && !empty($user->rights->commande->lire)) {
$elementList['order_send'] = img_picto('', 'order', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendOrder'));
$elementList['order_send'] = img_picto('', 'order', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendOrder'));
}
if (isModEnabled('facture') && !empty($user->rights->facture->lire)) {
$elementList['facture_send'] = img_picto('', 'bill', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendInvoice'));
$elementList['facture_send'] = img_picto('', 'bill', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendInvoice'));
}
if (!empty($conf->expedition->enabled)) {
$elementList['shipping_send'] = img_picto('', 'dolly', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendShipment'));
$elementList['shipping_send'] = img_picto('', 'dolly', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendShipment'));
}
if (!empty($conf->reception->enabled)) {
$elementList['reception_send'] = img_picto('', 'dollyrevert', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendReception'));
$elementList['reception_send'] = img_picto('', 'dollyrevert', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendReception'));
}
if (!empty($conf->ficheinter->enabled)) {
$elementList['fichinter_send'] = img_picto('', 'intervention', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendIntervention'));
$elementList['fichinter_send'] = img_picto('', 'intervention', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendIntervention'));
}
if (!empty($conf->supplier_proposal->enabled)) {
$elementList['supplier_proposal_send'] = img_picto('', 'propal', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendSupplierRequestForQuotation'));
$elementList['supplier_proposal_send'] = img_picto('', 'propal', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendSupplierRequestForQuotation'));
}
if ((!empty($conf->fournisseur->enabled) && !empty($user->rights->fournisseur->commande->lire) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (!empty($conf->supplier_order->enabled) && !empty($user->rights->supplier_order->lire))) {
$elementList['order_supplier_send'] = img_picto('', 'order', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendSupplierOrder'));
$elementList['order_supplier_send'] = img_picto('', 'order', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendSupplierOrder'));
}
if ((!empty($conf->fournisseur->enabled) && !empty($user->rights->fournisseur->facture->lire) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (!empty($conf->supplier_invoice->enabled) && !empty($user->rights->supplier_invoice->lire))) {
$elementList['invoice_supplier_send'] = img_picto('', 'bill', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendSupplierInvoice'));
$elementList['invoice_supplier_send'] = img_picto('', 'bill', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendSupplierInvoice'));
}
if (!empty($conf->contrat->enabled) && !empty($user->rights->contrat->lire)) {
$elementList['contract'] = img_picto('', 'contract', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendContract'));
$elementList['contract'] = img_picto('', 'contract', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendContract'));
}
if (!empty($conf->ticket->enabled) && !empty($user->rights->ticket->read)) {
$elementList['ticket_send'] = img_picto('', 'ticket', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToTicket'));
$elementList['ticket_send'] = img_picto('', 'ticket', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToTicket'));
}
if (!empty($conf->expensereport->enabled) && !empty($user->rights->expensereport->lire)) {
$elementList['expensereport_send'] = img_picto('', 'trip', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToTExpenseReport'));
$elementList['expensereport_send'] = img_picto('', 'trip', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToExpenseReport'));
}
if (isModEnabled('agenda')) {
$elementList['actioncomm_send'] = img_picto('', 'action', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendEventPush'));
$elementList['actioncomm_send'] = img_picto('', 'action', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendEventPush'));
}
if (!empty($conf->eventorganization->enabled) && !empty($user->rights->eventorganization->read)) {
$elementList['conferenceorbooth'] = img_picto('', 'action', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendEventOrganization'));
$elementList['conferenceorbooth'] = img_picto('', 'action', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendEventOrganization'));
}
if (!empty($conf->partnership->enabled) && !empty($user->rights->partnership->read)) {
$elementList['partnership_send'] = img_picto('', 'partnership', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToPartnership'));
$elementList['partnership_send'] = img_picto('', 'partnership', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToPartnership'));
}
$parameters = array('elementList'=>$elementList);

View File

@ -172,12 +172,12 @@ if ($action == 'add') {
$action = 'create';
$error++;
}
if (!$error && GETPOST('menuId') && GETPOST('type') == 'top') {
if (!$error && GETPOST('menuId', 'alphanohtml', 3) && GETPOST('type') == 'top') {
setEventMessages($langs->trans("ErrorTopMenuMustHaveAParentWithId0"), null, 'errors');
$action = 'create';
$error++;
}
if (!$error && !GETPOST('menuId') && GETPOST('type') == 'left') {
if (!$error && !GETPOST('menuId', 'alphanohtml', 3) && GETPOST('type') == 'left') {
setEventMessages($langs->trans("ErrorLeftMenuMustHaveAParentId"), null, 'errors');
$action = 'create';
$error++;

View File

@ -43,10 +43,15 @@ require_once DOL_DOCUMENT_ROOT.'/admin/dolistore/class/dolistore.class.php';
// Load translation files required by the page
$langs->loadLangs(array("errors", "admin", "modulebuilder"));
$mode = GETPOSTISSET('mode') ? GETPOST('mode', 'alpha') : (empty($conf->global->MAIN_MODULE_SETUP_ON_LIST_BY_DEFAULT) ? 'commonkanban' : 'common');
if (empty($mode)) {
$mode = 'common';
// if we set another view list mode, we keep it (till we change one more time)
if (GETPOSTISSET('mode')) {
$mode = GETPOST('mode', 'alpha');
if ($mode =='common' || $mode =='commonkanban')
dolibarr_set_const($db, "MAIN_MODULE_SETUP_ON_LIST_BY_DEFAULT", $mode, 'chaine', 0, '', $conf->entity);
} else {
$mode = (empty($conf->global->MAIN_MODULE_SETUP_ON_LIST_BY_DEFAULT) ? 'commonkanban' : $conf->global->MAIN_MODULE_SETUP_ON_LIST_BY_DEFAULT);
}
$action = GETPOST('action', 'aZ09');
$value = GETPOST('value', 'alpha');
$page_y = GETPOST('page_y', 'int');

View File

@ -33,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/multicurrency/class/multicurrency.class.php';
$langs->loadLangs(array('admin', 'multicurrency'));
// Access control
if (!$user->admin || empty($conf->multicurrency->enabled)) {
if (!$user->admin || !isModEnabled('multicurrency')) {
accessforbidden();
}

View File

@ -77,7 +77,7 @@ if ($action == 'setconst' && $user->admin) {
$constnote = dol_escape_htmltag($setupconst['note']);
$result = dolibarr_set_const($db, $constname, $constvalue, $consttype, 0, $constnote, $conf->entity);
if (!$result > 0) {
if (!($result > 0)) {
$error++;
}
}
@ -96,7 +96,7 @@ if ($action == 'setvalue' && $user->admin) {
$db->begin();
$result = dolibarr_set_const($db, $varname, $value, 'chaine', 0, '', $conf->entity);
if (!$result > 0) {
if (!($result > 0)) {
$error++;
}
@ -218,7 +218,6 @@ if ($mode == 'setup' && $user->admin) {
$tokenobj = null;
// Token
require_once DOL_DOCUMENT_ROOT.'/includes/OAuth/bootstrap.php';
require_once DOL_DOCUMENT_ROOT.'/includes/OAuth/bootstrap.php';
// Dolibarr storage
$storage = new DoliStorage($db, $conf);
try {
@ -281,7 +280,7 @@ if ($mode == 'setup' && $user->admin) {
print "</tr>\n";
print '<tr class="oddeven">';
print '<td'.($key['required'] ? ' class="required"' : '').'>';
print '<td'.(empty($key['required']) ? '' : ' class="required"').'>';
//var_dump($key);
print $langs->trans("OAuthIDSecret").'</td>';
print '<td>';
@ -292,14 +291,13 @@ if ($mode == 'setup' && $user->admin) {
print '</tr>'."\n";
print '<tr class="oddeven">';
print '<td'.($key['required'] ? ' class="required"' : '').'>';
print '<td'.(empty($key['required']) ? '' : ' class="required"').'>';
//var_dump($key);
print $langs->trans("IsTokenGenerated");
print '</td>';
print '<td>';
if (is_object($tokenobj)) {
// TODO Read in database to get the date of creation of token
print $form->textwithpicto(yn(1), $langs->trans("HasAccessToken").' : ');
print $form->textwithpicto(yn(1), $langs->trans("HasAccessToken").' : '.dol_print_date($storage->date_modification, 'dayhour').' state='.dol_escape_htmltag($storage->state));
} else {
print '<span class="opacitymedium">'.$langs->trans("NoAccessToken").'</span>';
}
@ -324,7 +322,7 @@ if ($mode == 'setup' && $user->admin) {
print '</tr>';
print '<tr class="oddeven">';
print '<td'.($key['required'] ? ' class="required"' : '').'>';
print '<td'.(empty($key['required']) ? '' : ' class="required"').'>';
//var_dump($key);
print $langs->trans("Token").'</td>';
print '<td colspan="2">';
@ -332,7 +330,7 @@ if ($mode == 'setup' && $user->admin) {
if (is_object($tokenobj)) {
//var_dump($tokenobj);
$tokentoshow = $tokenobj->getAccessToken();
print '<span class="" title="'.dol_escape_htmltag($tokentoshow).'">'.showValueWithClipboardCPButton($tokentoshow, 1, dol_trunc($tokentoshow, 32)).'<br>';
print '<span class="" title="'.dol_escape_htmltag($tokentoshow).'">'.showValueWithClipboardCPButton($tokentoshow, 1, dol_trunc($tokentoshow, 32)).'</span><br>';
//print 'Refresh: '.$tokenobj->getRefreshToken().'<br>';
//print 'EndOfLife: '.$tokenobj->getEndOfLife().'<br>';
//var_dump($tokenobj->getExtraParams());
@ -357,7 +355,7 @@ if ($mode == 'setup' && $user->admin) {
// Token expired
print '<tr class="oddeven">';
print '<td'.($key['required'] ? ' class="required"' : '').'>';
print '<td'.(empty($key['required']) ? '' : ' class="required"').'>';
//var_dump($key);
print $langs->trans("TOKEN_EXPIRED");
print '</td>';
@ -368,7 +366,7 @@ if ($mode == 'setup' && $user->admin) {
// Token expired at
print '<tr class="oddeven">';
print '<td'.($key['required'] ? ' class="required"' : '').'>';
print '<td'.(empty($key['required']) ? '' : ' class="required"').'>';
//var_dump($key);
print $langs->trans("TOKEN_EXPIRE_AT");
print '</td>';

View File

@ -166,6 +166,10 @@ if ($action == 'update') {
dolibarr_set_const($db, "PDF_SHOW_LINK_TO_ONLINE_PAYMENT", GETPOST('PDF_SHOW_LINK_TO_ONLINE_PAYMENT', 'alpha'), 'chaine', 0, '', $conf->entity);
}
if (GETPOSTISSET('DOC_SHOW_FIRST_SALES_REP')) {
dolibarr_set_const($db, "DOC_SHOW_FIRST_SALES_REP", GETPOST('DOC_SHOW_FIRST_SALES_REP', 'alpha'), 'chaine', 0, '', $conf->entity);
}
if (GETPOSTISSET('PDF_INCLUDE_ALIAS_IN_THIRDPARTY_NAME')) {
dolibarr_set_const($db, "PDF_INCLUDE_ALIAS_IN_THIRDPARTY_NAME", GETPOST('PDF_INCLUDE_ALIAS_IN_THIRDPARTY_NAME', 'alpha'), 'chaine', 0, '', $conf->entity);
}
@ -568,6 +572,18 @@ print '<tr class="oddeven"><td>'.$langs->trans("ShowDetailsInPDFPageFoot").'</td
print $form->selectarray('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', $arraydetailsforpdffoot, (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS : 0));
print '</td></tr>';
// Show the first sales representative
print '<tr class="oddeven"><td>'.$langs->trans("DOC_SHOW_FIRST_SALES_REP");
print ' <span class="opacitymedium">('.$langs->trans("SalesRepresentativeInfo").')</span>';
print '</td><td>';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('DOC_SHOW_FIRST_SALES_REP');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("DOC_SHOW_FIRST_SALES_REP", $arrval, $conf->global->DOC_SHOW_FIRST_SALES_REP);
}
// Show alias in thirdparty name
/* Disabled because not yet completely implemented (does not work when we force a contact on object)

View File

@ -102,7 +102,7 @@ print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="update">';
if (!empty($conf->propal->enabled)) {
if (isModEnabled('propal')) {
print load_fiche_titre($langs->trans("Proposal"), '', '');
print '<div class="div-table-responsive-no-min">';

View File

@ -183,8 +183,8 @@ if ($action == 'testtemplate' && $user->admin) {
// test
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$object = new Facture($db);
//$object->initAsSpecimen();
$object->fetch(18);
$object->initAsSpecimen();
//$object->fetch(18);
//var_dump($object->lines);
$ret = $printer->sendToPrinter($object, $templateid, 1);
if ($ret == 0) {

View File

@ -47,7 +47,7 @@ $type = 'reception';
* Actions
*/
if (!empty($conf->reception->enabled) && empty($conf->global->MAIN_SUBMODULE_RECEPTION)) {
if (isModEnabled('reception') && empty($conf->global->MAIN_SUBMODULE_RECEPTION)) {
// This option should always be set to on when module is on.
dolibarr_set_const($db, "MAIN_SUBMODULE_RECEPTION", "1", 'chaine', 0, '', $conf->entity);
}

View File

@ -78,9 +78,10 @@ if ($action == 'updateMask') {
$maskconststocktransfer = GETPOST('maskconststocktransfer', 'alpha');
$maskstocktransfer = GETPOST('maskStockTransfer', 'alpha');
if ($maskconststocktransfer) $res = dolibarr_set_const($db, $maskconststocktransfer, $maskstocktransfer, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if ($maskconststocktransfer) {
$res = dolibarr_set_const($db, $maskconststocktransfer, $maskstocktransfer, 'chaine', 0, '', $conf->entity);
if ($res <= 0) $error++;
}
if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');

View File

@ -498,7 +498,7 @@ print '<input type="submit" class="button button-edit" value="'.$langs->trans("M
print "</td></tr>\n";
print '</form>';
if (!empty($conf->banque->enabled)) {
if (isModEnabled('banque')) {
print '<tr class="oddeven"><td>';
print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL").'</td><td>&nbsp;</td><td class="right">';
if (!empty($conf->use_javascript_ajax)) {

View File

@ -293,7 +293,7 @@ print '<option value="'.LOG_DEBUG.'" '.($conf->global->SYSLOG_LEVEL >= LOG_DEBUG
print '</select>';
print '</td></tr>';
if (!empty($conf->loghandlers['mod_syslog_file']) && !empty($conf->cron->enabled)) {
if (!empty($conf->loghandlers['mod_syslog_file']) && isModEnabled('cron')) {
print '<tr class="oddeven"><td width="140">'.$langs->trans("SyslogFileNumberOfSaves").'</td>';
print '<td colspan="2"><input type="number" name="file_saves" placeholder="14" min="0" step="1" value="'.getDolGlobalString('SYSLOG_FILE_SAVES').'" />';
print ' (<a href="'.dol_buildpath('/cron/list.php', 1).'?search_label=CompressSyslogs&status=-1">'.$langs->trans('ConfigureCleaningCronjobToSetFrequencyOfSaves').'</a>)</td></tr>';

View File

@ -418,6 +418,11 @@ 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 '<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 '<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; ";
@ -443,13 +448,7 @@ 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 '<br>';
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 '<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 '<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").': 2)</span>'."<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 '<br>';
print '<br>';
@ -458,15 +457,6 @@ print '<br>';
print load_fiche_titre($langs->trans("OtherSetup").' ('.$langs->trans("Experimental").')', '', 'folder');
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 '<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 '<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 '<br>';
print '<strong>MAIN_EXEC_USE_POPEN</strong> = ';
if (empty($conf->global->MAIN_EXEC_USE_POPEN)) {
print '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>';
@ -483,7 +473,36 @@ if ($execmethod == 2) {
print ' &nbsp; ('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or").' 1)';
print '</span>';
}
print "<br>";
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 '<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 '<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 '<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").": \"default-src 'self'; img-src *;\")</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").": \"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>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\")</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 '<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 '<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 '<br>';
print '<br>';

View File

@ -539,7 +539,7 @@ print $formcategory->textwithpicto('', $langs->trans("TicketsAutoNotifyCloseHelp
print '</td>';
print '</tr>';
if (! empty($conf->product->enabled)) {
if (isModEnabled('product')) {
print '<tr class="oddeven"><td>'.$langs->trans("TicketChooseProductCategory").'</td>';
print '<td class="left">';
$formcategory->selectProductCategory($conf->global->TICKET_PRODUCT_CATEGORY, 'product_category_id');

View File

@ -302,7 +302,7 @@ if ($result) {
$center = '';
if ($num) {
$center = '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=purge">'.$langs->trans("Purge").'</a>';
$center = '<a class="butActionDelete small" href="'.$_SERVER["PHP_SELF"].'?action=purge">'.$langs->trans("Purge").'</a>';
}
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
@ -459,7 +459,7 @@ if ($result) {
// More informations
print '<td class="right">';
$htmltext = '<b>'.$langs->trans("UserAgent").'</b>: '.($obj->user_agent ? dol_string_nohtmltag($obj->user_agent) : $langs->trans("Unknown"));
$htmltext .= '<br><b>'.$langs->trans("PrefixSession").'</b>: '.($obj->prefix_session ? dol_string_nohtmltag($obj->prefix_session) : $langs->trans("Unknown"));
$htmltext .= '<br><b>'.$langs->trans("SuffixSessionName").' (DOLSESSID_...)</b>: '.($obj->prefix_session ? dol_string_nohtmltag($obj->prefix_session) : $langs->trans("Unknown"));
print $form->textwithpicto('', $htmltext);
print '</td>';

View File

@ -109,7 +109,7 @@ $tabrowid[1] = "";
// Condition to show dictionary in setup page
$tabcond = array();
$tabcond[1] = (!empty($conf->website->enabled));
$tabcond[1] = (isModEnabled('website'));
// List of help for fields
$tabhelp = array();

View File

@ -355,7 +355,7 @@ if (isModEnabled('societe')) {
// For products
if ($conf->product->enabled || $conf->product->service) {
if (isModEnabled('product') || isModEnabled('service')) {
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="mode" value="label">';
print '<input type="hidden" name="action" value="initbarcodeproducts">';

View File

@ -361,11 +361,11 @@ class BlockedLog
$this->amounts = $amounts;
// date
if ($object->element == 'payment' || $object->element == 'payment_supplier') {
$this->date_object = $object->datepaye;
$this->date_object = empty($object->datepaye) ? $object->date : $object->datepaye;
} elseif ($object->element == 'payment_salary') {
$this->date_object = $object->datev;
} elseif ($object->element == 'payment_donation' || $object->element == 'payment_various') {
$this->date_object = $object->datepaid ? $object->datepaid : $object->datep;
$this->date_object = empty($object->datepaid) ? $object->datep : $object->datepaid;
} elseif ($object->element == 'subscription') {
$this->date_object = $object->dateh;
} elseif ($object->element == 'cashcontrol') {
@ -527,7 +527,7 @@ class BlockedLog
$totalamount = 0;
// Loop on each invoice payment amount
// Loop on each invoice payment amount (payment_part)
if (is_array($object->amounts) && !empty($object->amounts)) {
$paymentpartnumber = 0;
foreach ($object->amounts as $objid => $amount) {

View File

@ -183,25 +183,10 @@ if (empty($reshook)) {
}
if (!$error) {
$bomline = new BOMLine($db);
$bomline->fk_bom = $id;
$bomline->fk_product = $idprod;
$bomline->fk_bom_child = $bom_child_id;
$bomline->qty = $qty;
$bomline->qty_frozen = (int) $qty_frozen;
$bomline->disable_stock_change = (int) $disable_stock_change;
$bomline->efficiency = $efficiency;
$bomline->fk_unit = $fk_unit;
$result = $object->addLine($idprod, $qty, $qty_frozen, $disable_stock_change, $efficiency, -1, $bom_child_id, null);
// Rang to use
$rangmax = $object->line_max(0);
$ranktouse = $rangmax + 1;
$bomline->position = ($ranktouse + 1);
$result = $bomline->create($user);
if ($result <= 0) {
setEventMessages($bomline->error, $bomline->errors, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
$action = '';
} else {
unset($_POST['idprod']);
@ -217,7 +202,7 @@ if (empty($reshook)) {
}
}
// Add line
// Update line
if ($action == 'updateline' && $user->rights->bom->write) {
$langs->load('errors');
$error = 0;
@ -234,26 +219,21 @@ if (empty($reshook)) {
$error++;
}
$bomline = new BOMLine($db);
$bomline->fetch($lineid);
$bomline->qty = $qty;
$bomline->qty_frozen = (int) $qty_frozen;
$bomline->disable_stock_change = (int) $disable_stock_change;
$bomline->efficiency = $efficiency;
if (!$error) {
$bomline = new BOMLine($db);
$bomline->fetch($lineid);
require_once DOL_DOCUMENT_ROOT.'/core/class/cunits.class.php';
$bomline->fk_unit = $fk_unit;
$result = $object->updateLine($lineid, $qty, (int) $qty_frozen, (int) $disable_stock_change, $efficiency, $bomline->position, $bomline->import_key);
$result = $bomline->update($user);
if ($result <= 0) {
setEventMessages($bomline->error, $bomline->errors, 'errors');
$action = '';
} else {
unset($_POST['idprod']);
unset($_POST['idprodservice']);
unset($_POST['qty']);
unset($_POST['qty_frozen']);
unset($_POST['disable_stock_change']);
if ($result <= 0) {
setEventMessages($object->error, $object->errors, 'errors');
$action = '';
} else {
unset($_POST['idprod']);
unset($_POST['idprodservice']);
unset($_POST['qty']);
unset($_POST['qty_frozen']);
unset($_POST['disable_stock_change']);
$object->fetchLines();
@ -566,7 +546,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
';
if (!empty($conf->use_javascript_ajax) && $object->status == 0) {
include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php';
include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php';
}
print '<div class="div-table-responsive-no-min">';
@ -581,7 +561,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Form to add new line
if ($object->status == 0 && $permissiontoadd && $action != 'selectlines') {
if ($action != 'editline') {
// Add products form
// Add products/services form
$parameters = array();

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2019 Maxime Kohlhaas <maxime@atm-consulting.fr>
* Copyright (C) 2020 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2022 Christian Humpel <christian.humpel@live.com>
*
* 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
@ -279,6 +280,177 @@ class Boms extends DolibarrApi
);
}
/**
* Get lines of an BOM
*
* @param int $id Id of BOM
*
* @url GET {id}/lines
*
* @return array
*/
public function getLines($id)
{
if (!DolibarrApiAccess::$user->rights->bom->read) {
throw new RestException(401);
}
$result = $this->bom->fetch($id);
if (!$result) {
throw new RestException(404, 'BOM not found');
}
if (!DolibarrApi::_checkAccessToResource('bom_bom', $this->bom->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$this->bom->getLinesArray();
$result = array();
foreach ($this->bom->lines as $line) {
array_push($result, $this->_cleanObjectDatas($line));
}
return $result;
}
/**
* Add a line to given BOM
*
* @param int $id Id of BOM to update
* @param array $request_data BOMLine data
*
* @url POST {id}/lines
*
* @return int
*/
public function postLine($id, $request_data = null)
{
if (!DolibarrApiAccess::$user->rights->bom->write) {
throw new RestException(401);
}
$result = $this->bom->fetch($id);
if (!$result) {
throw new RestException(404, 'BOM not found');
}
if (!DolibarrApi::_checkAccessToResource('bom_bom', $this->bom->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$request_data = (object) $request_data;
$updateRes = $this->bom->addLine(
$request_data->fk_product,
$request_data->qty,
$request_data->qty_frozen,
$request_data->disable_stock_change,
$request_data->efficiency,
$request_data->position,
$request_data->fk_bom_child,
$request_data->import_key
);
if ($updateRes > 0) {
return $updateRes;
} else {
throw new RestException(400, $this->bom->error);
}
}
/**
* Update a line to given BOM
*
* @param int $id Id of BOM to update
* @param int $lineid Id of line to update
* @param array $request_data BOMLine data
*
* @url PUT {id}/lines/{lineid}
*
* @return array|bool
*/
public function putLine($id, $lineid, $request_data = null)
{
if (!DolibarrApiAccess::$user->rights->bom->write) {
throw new RestException(401);
}
$result = $this->bom->fetch($id);
if (!$result) {
throw new RestException(404, 'BOM not found');
}
if (!DolibarrApi::_checkAccessToResource('bom_bom', $this->bom->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$request_data = (object) $request_data;
$updateRes = $this->bom->updateLine(
$lineid,
$request_data->qty,
$request_data->qty_frozen,
$request_data->disable_stock_change,
$request_data->efficiency,
$request_data->position,
$request_data->import_key
);
if ($updateRes > 0) {
$result = $this->get($id);
unset($result->line);
return $this->_cleanObjectDatas($result);
}
return false;
}
/**
* Delete a line to given BOM
*
*
* @param int $id Id of BOM to update
* @param int $lineid Id of line to delete
*
* @url DELETE {id}/lines/{lineid}
*
* @return int
*
* @throws RestException 401
* @throws RestException 404
* @throws RestException 500
*/
public function deleteLine($id, $lineid)
{
if (!DolibarrApiAccess::$user->rights->bom->write) {
throw new RestException(401);
}
$result = $this->bom->fetch($id);
if (!$result) {
throw new RestException(404, 'BOM not found');
}
if (!DolibarrApi::_checkAccessToResource('bom_bom', $this->bom->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
//Check the rowid is a line of current bom object
$lineIdIsFromObject = false;
foreach ($this->bom->lines as $bl) {
if ($bl->id == $lineid) {
$lineIdIsFromObject = true;
break;
}
}
if (!$lineIdIsFromObject) {
throw new RestException(500, 'Line to delete (rowid: '.$lineid.') is not a line of BOM (id: '.$this->bom->id.')');
}
$updateRes = $this->bom->deleteline(DolibarrApiAccess::$user, $lineid);
if ($updateRes > 0) {
return $this->get($id);
} else {
throw new RestException(405, $this->bom->error);
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**

View File

@ -556,6 +556,207 @@ class BOM extends CommonObject
//return $this->deleteCommon($user, $notrigger, 1);
}
/**
* Add an BOM line into database (linked to BOM)
*
* @param int $fk_product Id of product
* @param float $qty Quantity
* @param int $qty_frozen Frozen quantity
* @param int $disable_stock_change Disable stock change on using in MO
* @param float $efficiency Efficiency in MO
* @param int $position Position of BOM-Line in BOM-Lines
* @param int $fk_bom_child Id of BOM Child
* @param string $import_key Import Key
* @return int <0 if KO, Id of created object if OK
*/
public function addLine($fk_product, $qty, $qty_frozen = 0, $disable_stock_change = 0, $efficiency = 1.0, $position = -1, $fk_bom_child = null, $import_key = null)
{
global $mysoc, $conf, $langs, $user;
$logtext = "::addLine bomid=$this->id, qty=$qty, fk_product=$fk_product, qty_frozen=$qty_frozen, disable_stock_change=$disable_stock_change, efficiency=$efficiency";
$logtext .= ", fk_bom_child=$fk_bom_child, import_key=$import_key";
dol_syslog(get_class($this).$logtext, LOG_DEBUG);
if ($this->statut == self::STATUS_DRAFT) {
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
// Clean parameters
if (empty($qty)) {
$qty = 0;
}
if (empty($qty_frozen)) {
$qty_frozen = 0;
}
if (empty($disable_stock_change)) {
$disable_stock_change = 0;
}
if (empty($efficiency)) {
$efficiency = 1.0;
}
if (empty($fk_bom_child)) {
$fk_bom_child = null;
}
if (empty($import_key)) {
$import_key = null;
}
if (empty($position)) {
$position = -1;
}
$qty = price2num($qty);
$efficiency = price2num($efficiency);
$position = price2num($position);
$this->db->begin();
// Rank to use
$rangMax = $this->line_max();
$rankToUse = $position;
if ($rankToUse <= 0 or $rankToUse > $rangMax) { // New line after existing lines
$rankToUse = $rangMax + 1;
} else { // New line between the existing lines
foreach ($this->lines as $bl) {
if ($bl->position >= $rankToUse) {
$bl->position++;
$bl->update($user);
}
}
}
// Insert line
$this->line = new BOMLine($this->db);
$this->line->context = $this->context;
$this->line->fk_bom = $this->id;
$this->line->fk_product = $fk_product;
$this->line->qty = $qty;
$this->line->qty_frozen = $qty_frozen;
$this->line->disable_stock_change = $disable_stock_change;
$this->line->efficiency = $efficiency;
$this->line->fk_bom_child = $fk_bom_child;
$this->line->import_key = $import_key;
$this->line->position = $rankToUse;
$result = $this->line->create($user);
if ($result > 0) {
$this->calculateCosts();
$this->db->commit();
return $result;
} else {
$this->error = $this->line->error;
dol_syslog(get_class($this)."::addLine error=".$this->error, LOG_ERR);
$this->db->rollback();
return -2;
}
} else {
dol_syslog(get_class($this)."::addLine status of BOM must be Draft to allow use of ->addLine()", LOG_ERR);
return -3;
}
}
/**
* Update an BOM line into database
*
* @param int $rowid Id of line to update
* @param float $qty Quantity
* @param int $qty_frozen Frozen quantity
* @param int $disable_stock_change Disable stock change on using in MO
* @param float $efficiency Efficiency in MO
* @param int $position Position of BOM-Line in BOM-Lines
* @param string $import_key Import Key
* @return int <0 if KO, Id of updated BOM-Line if OK
*/
public function updateLine($rowid, $qty, $qty_frozen = 0, $disable_stock_change = 0, $efficiency = 1.0, $position = -1, $import_key = null)
{
global $mysoc, $conf, $langs, $user;
$logtext = "::updateLine bomid=$this->id, qty=$qty, qty_frozen=$qty_frozen, disable_stock_change=$disable_stock_change, efficiency=$efficiency";
$logtext .= ", import_key=$import_key";
dol_syslog(get_class($this).$logtext, LOG_DEBUG);
if ($this->statut == self::STATUS_DRAFT) {
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
// Clean parameters
if (empty($qty)) {
$qty = 0;
}
if (empty($qty_frozen)) {
$qty_frozen = 0;
}
if (empty($disable_stock_change)) {
$disable_stock_change = 0;
}
if (empty($efficiency)) {
$efficiency = 1.0;
}
if (empty($import_key)) {
$import_key = null;
}
if (empty($position)) {
$position = -1;
}
$qty = price2num($qty);
$efficiency = price2num($efficiency);
$position = price2num($position);
$this->db->begin();
//Fetch current line from the database and then clone the object and set it in $oldline property
$line = new BOMLine($this->db);
$line->fetch($rowid);
$line->fetch_optionals();
$staticLine = clone $line;
$line->oldcopy = $staticLine;
$this->line = $line;
$this->line->context = $this->context;
// Rank to use
$rankToUse = (int) $position;
if ($rankToUse != $line->oldcopy->position) { // check if position have a new value
foreach ($this->lines as $bl) {
if ($bl->position >= $rankToUse AND $bl->position < ($line->oldcopy->position + 1)) { // move rank up
$bl->position++;
$bl->update($user);
}
if ($bl->position <= $rankToUse AND $bl->position > ($line->oldcopy->position)) { // move rank down
$bl->position--;
$bl->update($user);
}
}
}
$this->line->fk_bom = $this->id;
$this->line->qty = $qty;
$this->line->qty_frozen = $qty_frozen;
$this->line->disable_stock_change = $disable_stock_change;
$this->line->efficiency = $efficiency;
$this->line->import_key = $import_key;
$this->line->position = $rankToUse;
$result = $this->line->update($user);
if ($result > 0) {
$this->calculateCosts();
$this->db->commit();
return $result;
} else {
$this->error = $this->line->error;
dol_syslog(get_class($this)."::addLine error=".$this->error, LOG_ERR);
$this->db->rollback();
return -2;
}
} else {
dol_syslog(get_class($this)."::addLine status of BOM must be Draft to allow use of ->addLine()", LOG_ERR);
return -3;
}
}
/**
* Delete a line of object in database
*
@ -571,7 +772,38 @@ class BOM extends CommonObject
return -2;
}
return $this->deleteLineCommon($user, $idline, $notrigger);
$this->db->begin();
//Fetch current line from the database and then clone the object and set it in $oldline property
$line = new BOMLine($this->db);
$line->fetch($idline);
$line->fetch_optionals();
$staticLine = clone $line;
$line->oldcopy = $staticLine;
$this->line = $line;
$this->line->context = $this->context;
$result = $this->line->delete($user, $notrigger);
//Positions (rank) reordering
foreach ($this->lines as $bl) {
if ($bl->position > ($line->oldcopy->position)) { // move rank down
$bl->position--;
$bl->update($user);
}
}
if ($result > 0) {
$this->calculateCosts();
$this->db->commit();
return $result;
} else {
$this->error = $this->line->error;
dol_syslog(get_class($this)."::addLine error=".$this->error, LOG_ERR);
$this->db->rollback();
return -2;
}
}
/**

View File

@ -703,13 +703,14 @@ class Categorie extends CommonObject
$type = $obj->element;
}
dol_syslog(get_class($this).'::add_type', LOG_DEBUG);
$this->db->begin();
$sql = "INSERT INTO ".MAIN_DB_PREFIX."categorie_".(empty($this->MAP_CAT_TABLE[$type]) ? $type : $this->MAP_CAT_TABLE[$type]);
$sql .= " (fk_categorie, fk_".(empty($this->MAP_CAT_FK[$type]) ? $type : $this->MAP_CAT_FK[$type]).")";
$sql .= " VALUES (".((int) $this->id).", ".((int) $obj->id).")";
dol_syslog(get_class($this).'::add_type', LOG_DEBUG);
if ($this->db->query($sql)) {
if (!empty($conf->global->CATEGORIE_RECURSIV_ADD)) {
$sql = 'SELECT fk_parent FROM '.MAIN_DB_PREFIX.'categorie';

View File

@ -677,7 +677,7 @@ if (empty($reshook) && $action == 'update') {
$object->fetch($id);
$object->fetch_optionals();
$object->fetch_userassigned();
$object->oldcopy = clone $object;
$object->oldcopy = dol_clone($object);
// Clean parameters
if ($fulldayevent) {
@ -927,7 +927,7 @@ if (empty($reshook) && $action == 'confirm_delete' && GETPOST("confirm") == 'yes
$object->fetch($id);
$object->fetch_optionals();
$object->fetch_userassigned();
$object->oldcopy = clone $object;
$object->oldcopy = dol_clone($object);
if ($user->rights->agenda->myactions->delete
|| $user->rights->agenda->allactions->delete) {

View File

@ -216,7 +216,9 @@ class CActionComm
if ($obj->module == 'shipping' && !empty($conf->expedition->enabled) && !empty($user->rights->expedition->lire)) {
$qualified = 1;
}
if (preg_split("/@/", $obj->module, -1)[1] == 'eventorganization' && !empty($conf->eventorganization->enabled)) {
// For case module = 'myobject@eventorganization'
$tmparray = preg_split("/@/", $obj->module, -1);
if (count($tmparray) > 1 && $tmparray[1] == 'eventorganization' && !empty($conf->eventorganization->enabled)) {
$qualified = 1;
}
// For the generic case with type = 'module...' and module = 'myobject@mymodule'

View File

@ -212,7 +212,7 @@ if (GETPOST("viewperuser", 'alpha') || $mode == 'show_peruser') {
$event->fetch($actionid);
$event->fetch_optionals();
$event->fetch_userassigned();
$event->oldcopy = clone $event;
$event->oldcopy = dol_clone($event);
$result = $event->delete();
}
@ -757,9 +757,10 @@ if ($type) {
$sql .= " AND ca.id = ".((int) $type);
}
if ($status == '0') {
// To do (not started)
$sql .= " AND a.percent = 0";
}
if ($status == '-1' || $status == 'na') {
if ($status == 'na') {
// Not applicable
$sql .= " AND a.percent = -1";
}

View File

@ -189,7 +189,7 @@ if ($action == 'delete_action' && $user->rights->agenda->delete) {
$event->fetch($actionid);
$event->fetch_optionals();
$event->fetch_userassigned();
$event->oldcopy = clone $event;
$event->oldcopy = dol_clone($event);
$result = $event->delete();
}

View File

@ -196,7 +196,7 @@ if ($action == 'delete_action' && $user->rights->agenda->delete) {
$event->fetch($actionid);
$event->fetch_optionals();
$event->fetch_userassigned();
$event->oldcopy = clone $event;
$event->oldcopy = dol_clone($event);
$result = $event->delete();
}

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