Merge remote-tracking branch 'upstream/develop' into 18a7

This commit is contained in:
Alexandre SPANGARO 2023-04-12 11:50:45 +02:00
commit 1708547d2a
319 changed files with 3132 additions and 1479 deletions

View File

@ -53,6 +53,10 @@ addons:
- php8.1-mysqli
- php8.1-xml
- php8.1-intl
- php8.2-pgsql
- php8.2-mysqli
- php8.2-xml
- php8.2-intl
env:
global:
@ -73,8 +77,8 @@ jobs:
php: '8.1'
env: DB=mysql
- stage: PHP Dev
if: type = push AND branch = 17.0
php: nightly
if: type = push AND branch = develop
php: '8.2'
env: DB=mysql
notifications:
@ -120,7 +124,7 @@ install:
squizlabs/php_codesniffer ^3
fi
# phpunit 9 is required for php 8
if [ "$TRAVIS_PHP_VERSION" = '8.0' ] || [ "$TRAVIS_PHP_VERSION" = '8.1' ] || [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then
if [ "$TRAVIS_PHP_VERSION" = '8.0' ] || [ "$TRAVIS_PHP_VERSION" = '8.1' ] || [ "$TRAVIS_PHP_VERSION" = '8.2' ] || [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then
composer self-update 2.4.4
composer -n require --ignore-platform-reqs phpunit/phpunit ^8 \
php-parallel-lint/php-parallel-lint ^1.2 \
@ -260,7 +264,7 @@ before_script:
# enable php-fpm
- sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf
- |
if [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = '7.1' ] || [ "$TRAVIS_PHP_VERSION" = '7.2' ] || [ "$TRAVIS_PHP_VERSION" = '7.3' ] || [ "$TRAVIS_PHP_VERSION" = '7.4' ] || [ "$TRAVIS_PHP_VERSION" = '8.0' ] || [ "$TRAVIS_PHP_VERSION" = '8.1' ] || [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then
if [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = '7.1' ] || [ "$TRAVIS_PHP_VERSION" = '7.2' ] || [ "$TRAVIS_PHP_VERSION" = '7.3' ] || [ "$TRAVIS_PHP_VERSION" = '7.4' ] || [ "$TRAVIS_PHP_VERSION" = '8.0' ] || [ "$TRAVIS_PHP_VERSION" = '8.1' ] || [ "$TRAVIS_PHP_VERSION" = '8.2' ] || [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then
# Copy the included pool
sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.d/www.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.d/www.conf
fi

View File

@ -280,6 +280,7 @@ Following changes may create regressions for some external modules, but were nec
* You must use "$objectoffield" to manipulate the current object inside the formulare of computed custom extrafields instead of $obj/$object.
* Making a global search is sending the parameter using always the name search_all (instead of sometimes sall and search_all)
* The property $url_last_version must be public if defined into module descriptor files;
* Filters in class field definitions must be a Dolibarr filter syntax string.
***** ChangeLog for 16.0.5 compared to 16.0.4 *****

View File

@ -19,6 +19,10 @@ override_dh_auto_clean:
override_dh_auto_build:
# Do nothing. Added to disable launchpad to use bugged dh_auto_build search for ant
# Force the compression format for control files
override_dh_builddeb:
dh_builddeb -- -Zxz
#override_dh_compress:
# dh_compress --no-act -X.png
@ -124,4 +128,4 @@ override_dh_fixperms:
# Give rights to the webserver on the upload directory
chown www-data:www-data debian/dolibarr/var/lib/dolibarr/documents
chmod 2775 debian/dolibarr/var/lib/dolibarr/documents

View File

@ -1,3 +1,5 @@
# Force use of gzip compression by dpkg-buildpackage
# Force use of gzip compression by dpkg-buildpackage for the tarball *.debian.tar.gz
# See also option --compression from command line of dpkg-buildpackage
# Format for the control files are defined into the rules file in override_dh_builddeb section
compression = "gzip"
#compression-level = 9

View File

@ -1050,16 +1050,16 @@ if ($nboftargetok) {
print "Go into directory $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build\n";
chdir("$BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build");
#$cmd="dpkg-source -b $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build";
$cmd="dpkg-buildpackage -us -uc";
$cmd="dpkg-buildpackage -us -uc --compression=gzip";
print "Launch DEB build ($cmd)\n";
$ret=`$cmd 2>&1 3>&1`;
print $ret."\n";
chdir("$olddir");
print "You can check bin package with lintian --pedantic -E -I \"$NEWDESTI/${FILENAMEDEB}_all.deb\"\n";
print "You can check src package with lintian --pedantic -E -I \"$NEWDESTI/${FILENAMEDEB}.dsc\"\n";
# Move to final dir
print "Move *_all.deb *.dsc *.orig.tar.gz *.changes to $NEWDESTI\n";
$ret=`mv $BUILDROOT/*_all.deb "$NEWDESTI/"`;

View File

@ -321,7 +321,7 @@ if ($resql) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
$param .= '&limit='.((int) $limit);
}
if ($search_account) {
$param .= '&search_account='.urlencode($search_account);

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2013-2023 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
@ -81,6 +81,10 @@ $list_account[] = '---Others---';
$list_account[] = 'ACCOUNTING_VAT_BUY_ACCOUNT';
$list_account[] = 'ACCOUNTING_VAT_SOLD_ACCOUNT';
$list_account[] = 'ACCOUNTING_VAT_PAY_ACCOUNT';
if (!empty($conf->global->ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE)) {
$list_account[] = 'ACCOUNTING_VAT_BUY_REVERSE_CHARGES_CREDIT';
$list_account[] = 'ACCOUNTING_VAT_BUY_REVERSE_CHARGES_DEBIT';
}
if (isModEnabled('banque')) {
$list_account[] = 'ACCOUNTING_ACCOUNT_TRANSFER_CASH';
}

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2013-2023 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
@ -66,12 +66,7 @@ $error = 0;
* Actions
*/
if (in_array($action, array(
'setBANK_DISABLE_DIRECT_INPUT',
'setACCOUNTANCY_COMBO_FOR_AUX',
'setACCOUNTING_MANAGE_ZERO',
'setACCOUNTING_LIST_SORT_VENTILATION_TODO',
'setACCOUNTING_LIST_SORT_VENTILATION_DONE'))) {
if (in_array($action, array('setBANK_DISABLE_DIRECT_INPUT', 'setACCOUNTANCY_COMBO_FOR_AUX', 'setACCOUNTING_MANAGE_ZERO'))) {
$constname = preg_replace('/^set/', '', $action);
$constvalue = GETPOST('value', 'int');
$res = dolibarr_set_const($db, $constname, $constvalue, 'yesno', 0, '', $conf->entity);
@ -121,34 +116,6 @@ if ($action == 'update') {
}
}
if ($action == 'setlistsorttodo') {
$setlistsorttodo = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "ACCOUNTING_LIST_SORT_VENTILATION_TODO", $setlistsorttodo, 'yesno', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
}
if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'mesgs');
}
}
if ($action == 'setlistsortdone') {
$setlistsortdone = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "ACCOUNTING_LIST_SORT_VENTILATION_DONE", $setlistsortdone, 'yesno', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
}
if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'mesgs');
}
}
if ($action == 'setmanagezero') {
$setmanagezero = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "ACCOUNTING_MANAGE_ZERO", $setmanagezero, 'yesno', 0, '', $conf->entity);
@ -275,6 +242,19 @@ if ($action == 'setenableautolettering') {
}
}
if ($action == 'setenablevatreversecharge') {
$setenablevatreversecharge = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE", $setenablevatreversecharge, 'yesno', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
}
if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'mesgs');
}
}
/*
* View
@ -404,33 +384,6 @@ print '<tr class="liste_titre">';
print '<td colspan="2">'.$langs->trans('BindingOptions').'</td>';
print "</tr>\n";
// TO DO Mutualize code for yes/no constants
print '<tr class="oddeven">';
print '<td>'.$langs->trans("ACCOUNTING_LIST_SORT_VENTILATION_TODO").'</td>';
if (!empty($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO)) {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setACCOUNTING_LIST_SORT_VENTILATION_TODO&value=0">';
print img_picto($langs->trans("Activated"), 'switch_on');
print '</a></td>';
} else {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setACCOUNTING_LIST_SORT_VENTILATION_TODO&value=1">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a></td>';
}
print '</tr>';
print '<tr class="oddeven">';
print '<td>'.$langs->trans("ACCOUNTING_LIST_SORT_VENTILATION_DONE").'</td>';
if (!empty($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE)) {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setACCOUNTING_LIST_SORT_VENTILATION_DONE&value=0">';
print img_picto($langs->trans("Activated"), 'switch_on');
print '</a></td>';
} else {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setACCOUNTING_LIST_SORT_VENTILATION_DONE&value=1">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a></td>';
}
print '</tr>';
// Param a user $user->rights->accounting->chartofaccount can access
foreach ($list_binding as $key) {
print '<tr class="oddeven value">';
@ -495,14 +448,20 @@ print '</tr>';
print '</table>';
print '<br>';
// Lettering params
// Show advanced options
print '<br>';
// Advanced params
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td colspan="2">'.$langs->trans('Options').' '.$langs->trans('Lettering').'</td>';
print '<td colspan="2">' . $langs->trans('OptionsAdvanced') . '</td>';
print "</tr>\n";
print '<tr class="oddeven">';
print '<td>'.$langs->trans("ACCOUNTING_ENABLE_LETTERING").'</td>';
print '<td>';
print $form->textwithpicto($langs->trans("ACCOUNTING_ENABLE_LETTERING"), $langs->trans("ACCOUNTING_ENABLE_LETTERING_DESC", $langs->transnoentitiesnoconv("NumMvts")).'<br>'.$langs->trans("EnablingThisFeatureIsNotNecessary")).'</td>';
if (!empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setenablelettering&value=0">';
print img_picto($langs->trans("Activated"), 'switch_on');
@ -516,7 +475,8 @@ print '</tr>';
if (!empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) {
print '<tr class="oddeven">';
print '<td>' . $langs->trans("ACCOUNTING_ENABLE_AUTOLETTERING") . '</td>';
print '<td>';
print $form->textwithpicto($langs->trans("ACCOUNTING_ENABLE_AUTOLETTERING"), $langs->trans("ACCOUNTING_ENABLE_AUTOLETTERING_DESC")) . '</td>';
if (!empty($conf->global->ACCOUNTING_ENABLE_AUTOLETTERING)) {
print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?token=' . newToken() . '&action=setenableautolettering&value=0">';
print img_picto($langs->trans("Activated"), 'switch_on');
@ -529,8 +489,23 @@ if (!empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) {
print '</tr>';
}
print '<tr class="oddeven">';
print '<td>';
print $form->textwithpicto($langs->trans("ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE"), $langs->trans("ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE_DESC", $langs->transnoentities("MenuDefaultAccounts"))).'</td>';
if (!empty($conf->global->ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE)) {
print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?token=' . newToken() . '&action=setenablevatreversecharge&value=0">';
print img_picto($langs->trans("Activated"), 'switch_on');
print '</a></td>';
} else {
print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?token=' . newToken() . '&action=setenablevatreversecharge&value=1">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a></td>';
}
print '</tr>';
print '</table>';
print '<div class="center"><input type="submit" class="button button-edit" name="button" value="'.$langs->trans('Modify').'"></div>';
print '</form>';

View File

@ -416,7 +416,7 @@ if ($resql) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
$param .= '&limit='.((int) $limit);
}
if ($searchCategoryProductOperator == 1) {
$param .= "&search_category_product_operator=".urlencode($searchCategoryProductOperator);

View File

@ -296,7 +296,7 @@ if ($resql) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
$param .= '&limit='.((int) $limit);
}
if ($search_subaccount) {
$param .= '&search_subaccount='.urlencode($search_subaccount);

View File

@ -327,7 +327,7 @@ if ($action != 'export_csv') {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
$param .= '&limit='.((int) $limit);
}
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $result, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit, 0, 0, 1);

View File

@ -715,7 +715,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
$param .= '&limit='.((int) $limit);
}
// List of mass actions available

View File

@ -686,7 +686,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
$param .= '&limit='.((int) $limit);
}
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $result, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit, 0, 0, 1);

View File

@ -816,8 +816,8 @@ class AccountancyExport
// Keep correct quadra named field instead of anon filler libelle_ecriture2 is 30 char not 32 !!!!
// as we use utf8, we must remove accent to have only one ascii char instead of utf8 2 chars for specials that report wrong line size that will exceed import format spec
// TODO: we should filter more than only accent to avoid wrong line size
// TODO: remove invoice number doc_ref in libelle,
// TODO: we should offer an option for customer to build the libelle using invoice number / name / date in accounting software
// TODO: remove invoice number doc_ref in label,
// TODO: we should offer an option for customer to build the label using invoice number / name / date in accounting software
//$Tab['libelle_ecriture2'] = str_pad(self::trunc($data->doc_ref . ' ' . $data->label_operation, 30), 30);
$Tab['libelle_ecriture2'] = str_pad(self::trunc($data->label_operation, 30), 30);
$Tab['codetva'] = str_repeat(' ', 2);

View File

@ -684,10 +684,10 @@ class AccountingAccount extends CommonObject
}
/**
* Retourne le libelle du statut d'un user (actif, inactif)
* Return the label of the status
*
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Label of status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function getLibStatut($mode = 0)
{
@ -696,11 +696,11 @@ class AccountingAccount extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoi le libelle d'un statut donne
* Return the label of a given status
*
* @param int $status Id status
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Label of status
* @param int $status Id status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function LibStatut($status, $mode = 0)
{

View File

@ -312,10 +312,10 @@ class AccountingJournal extends CommonObject
}
/**
* Retourne le libelle du statut d'un user (actif, inactif)
* Return the label of the status
*
* @param int $mode 0=libelle long, 1=libelle court
* @return string Label of type
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function getLibType($mode = 0)
{
@ -327,7 +327,7 @@ class AccountingJournal extends CommonObject
* Return type of an accounting journal
*
* @param int $nature Id type
* @param int $mode 0=libelle long, 1=libelle court
* @param int $mode 0=label long, 1=label short
* @return string Label of type
*/
public function LibType($nature, $mode = 0)

View File

@ -65,10 +65,10 @@ $search_country = GETPOST('search_country', 'alpha');
$search_tvaintra = GETPOST('search_tvaintra', 'alpha');
// Load variable for pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusonPour le détail de la facture ref…e') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page < 0) {
$page = 0;
}
@ -81,6 +81,8 @@ if (!$sortfield) {
if (!$sortorder) {
if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE > 0) {
$sortorder = "DESC";
} else {
$sortorder = "ASC";
}
}
@ -159,6 +161,12 @@ if (is_array($changeaccount) && count($changeaccount) > 0 && $user->hasRight('ac
}
}
if (GETPOST('sortfield') == 'f.datef, f.ref, fd.rowid') {
$value = (GETPOST('sortorder') == 'asc,asc,asc' ? 0 : 1);
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
$res = dolibarr_set_const($db, "ACCOUNTING_LIST_SORT_VENTILATION_DONE", $value, 'yesno', 0, '', $conf->entity);
}
/*
* View
@ -317,7 +325,7 @@ if ($result) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
$param .= '&limit='.((int) $limit);
}
if ($search_societe) {
$param .= "&search_societe=".urlencode($search_societe);

View File

@ -91,6 +91,8 @@ if (!$sortfield) {
if (!$sortorder) {
if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO > 0) {
$sortorder = "DESC";
} else {
$sortorder = "ASC";
}
}
@ -208,6 +210,11 @@ if ($massaction == 'ventil' && $user->rights->accounting->bind->write) {
}
}
if (GETPOST('sortfield') == 'f.datef, f.ref, l.rowid') {
$value = (GETPOST('sortorder') == 'asc,asc,asc' ? 0 : 1);
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
$res = dolibarr_set_const($db, "ACCOUNTING_LIST_SORT_VENTILATION_TODO", $value, 'yesno', 0, '', $conf->entity);
}
/*
@ -382,7 +389,7 @@ if ($result) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
$param .= '&limit='.((int) $limit);
}
if ($search_societe) {
$param .= '&search_societe='.urlencode($search_societe);

View File

@ -75,6 +75,8 @@ if (!$sortfield) {
if (!$sortorder) {
if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE > 0) {
$sortorder = "DESC";
} else {
$sortorder = "ASC";
}
}
@ -149,6 +151,12 @@ if (is_array($changeaccount) && count($changeaccount) > 0 && $user->rights->acco
}
}
if (GETPOST('sortfield') == 'erd.date, erd.rowid') {
$value = (GETPOST('sortorder') == 'asc,asc' ? 0 : 1);
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
$res = dolibarr_set_const($db, "ACCOUNTING_LIST_SORT_VENTILATION_DONE", $value, 'yesno', 0, '', $conf->entity);
}
/*
* View
@ -248,7 +256,7 @@ if ($result) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
$param .= '&limit='.((int) $limit);
}
if ($search_login) {
$param .= '&search_login='.urlencode($search_login);

View File

@ -84,6 +84,8 @@ if (!$sortfield) {
if (!$sortorder) {
if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO > 0) {
$sortorder = "DESC";
} else {
$sortorder = "ASC";
}
}
@ -199,6 +201,11 @@ if ($massaction == 'ventil' && $user->rights->accounting->bind->write) {
}
}
if (GETPOST('sortfield') == 'erd.date, erd.rowid') {
$value = (GETPOST('sortorder') == 'asc,asc' ? 0 : 1);
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
$res = dolibarr_set_const($db, "ACCOUNTING_LIST_SORT_VENTILATION_TODO", $value, 'yesno', 0, '', $conf->entity);
}
/*
@ -306,7 +313,7 @@ if ($result) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
$param .= '&limit='.((int) $limit);
}
if ($search_login) {
$param .= '&search_login='.urlencode($search_login);

View File

@ -1211,6 +1211,8 @@ if (empty($action) || $action == 'view') {
print '<td class="right nowraponall amount">'.($mt >= 0 ? price($mt) : '')."</td>";
print '<td class="right nowraponall amount">'.($mt < 0 ? price(-$mt) : '')."</td>";
print "</tr>";
$i++;
}
}
@ -1336,6 +1338,8 @@ if (empty($action) || $action == 'view') {
print '<td class="right nowraponall amount">'.($mt >= 0 ? price($mt) : '')."</td>";
print "</tr>";
$i++;
}
}
} else { // Waiting account
@ -1373,11 +1377,18 @@ if (empty($action) || $action == 'view') {
print '<td class="right nowraponall amount">'.($mt < 0 ? price(-$mt) : '')."</td>";
print '<td class="right nowraponall amount">'.($mt >= 0 ? price($mt) : '')."</td>";
print "</tr>";
$i++;
}
}
}
}
if (!$i) {
$colspan = 8;
print '<tr class="oddeven"><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
}
print "</table>";
print '</div>';

View File

@ -615,6 +615,8 @@ if (empty($action) || $action == 'view') {
print '<td class="right nowraponall amount">'.($mt >= 0 ? price($mt) : '')."</td>";
print '<td class="right nowraponall amount">'.($mt < 0 ? price(-$mt) : '')."</td>";
print "</tr>";
$i++;
}
}
@ -649,6 +651,8 @@ if (empty($action) || $action == 'view') {
print '<td class="right nowraponall amount">'.($mt < 0 ? price(-$mt) : '')."</td>";
print '<td class="right nowraponall amount">'.($mt >= 0 ? price($mt) : '')."</td>";
print "</tr>";
$i++;
}
// VAT
@ -685,11 +689,18 @@ if (empty($action) || $action == 'view') {
print '<td class="right nowraponall amount">'.($mt >= 0 ? price($mt) : '')."</td>";
print '<td class="right nowraponall amount">'.($mt < 0 ? price(-$mt) : '')."</td>";
print "</tr>";
$i++;
}
}
}
}
if (!$i) {
$colspan = 7;
print '<tr class="oddeven"><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
}
print "</table>";
print '</div>';

View File

@ -3,7 +3,7 @@
* Copyright (C) 2007-2010 Jean Heimburger <jean@tiaris.info>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2013-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2013-2023 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
@ -32,6 +32,7 @@ require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
@ -103,9 +104,11 @@ if (!GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end))
$date_end = dol_get_last_day($pastmonthyear, $pastmonth, false);
}
$sql = "SELECT f.rowid, f.ref as ref, f.type, f.datef as df, f.libelle,f.ref_supplier, f.date_lim_reglement as dlr, f.close_code,";
$sql = "SELECT f.rowid, f.ref as ref, f.type, f.datef as df, f.libelle as label, f.ref_supplier, f.date_lim_reglement as dlr, f.close_code, f.vat_reverse_charge,";
$sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.tva as total_tva, fd.total_localtax1, fd.total_localtax2, fd.tva_tx, fd.total_ttc, fd.vat_src_code, fd.info_bits,";
$sql .= " s.rowid as socid, s.nom as name, s.fournisseur, s.code_client, s.code_fournisseur,";
$sql .= " p.default_vat_code AS product_buy_default_vat_code, p.tva_tx as product_buy_vat, p.localtax1_tx as product_buy_localvat1, p.localtax2_tx as product_buy_localvat2,";
$sql .= " co.code as country_code, co.label as country_label,";
$sql .= " s.rowid as socid, s.nom as name, s.fournisseur, s.code_client, s.code_fournisseur, s.fk_pays,";
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
$sql .= " spe.accountancy_code_customer as code_compta,";
$sql .= " spe.accountancy_code_supplier as code_compta_fournisseur,";
@ -127,6 +130,7 @@ if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON aa.rowid = fd.fk_code_ventilation";
$sql .= " JOIN ".MAIN_DB_PREFIX."facture_fourn as f ON f.rowid = fd.fk_facture_fourn";
$sql .= " JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = s.fk_pays ";
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity);
}
@ -166,12 +170,18 @@ if ($result) {
$tablocaltax2 = array();
$tabcompany = array();
$tabother = array();
$tabrctva = array();
$tabrclocaltax1 = array();
$tabrclocaltax2 = array();
$num = $db->num_rows($result);
// Variables
$cptfour = ($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER != "") ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : 'NotDefined';
$cpttva = (!empty($conf->global->ACCOUNTING_VAT_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_BUY_ACCOUNT : 'NotDefined';
$rcctva = (!empty($conf->global->ACCOUNTING_VAT_BUY_REVERSE_CHARGES_CREDIT)) ? $conf->global->ACCOUNTING_VAT_BUY_REVERSE_CHARGES_CREDIT : 'NotDefined';
$rcdtva = (!empty($conf->global->ACCOUNTING_VAT_BUY_REVERSE_CHARGES_DEBIT)) ? $conf->global->ACCOUNTING_VAT_BUY_REVERSE_CHARGES_DEBIT : 'NotDefined';
$country_code_in_EEC = getCountriesInEEC(); // This make a database call but there is a cache done into $conf->cache['country_code_in_EEC']
$i = 0;
while ($i < $num) {
@ -230,6 +240,53 @@ if ($result) {
$tablocaltax2[$obj->rowid][$compta_localtax2] = 0;
}
// VAT Reverse charge
if (($mysoc->country_code == 'FR' || !empty($conf->global->ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE)) && $obj->vat_reverse_charge == 1 && in_array($obj->country_code, $country_code_in_EEC)) {
$rcvatdata = getTaxesFromId($obj->product_buy_vat . ($obj->product_buy_default_vat_code ? ' (' . $obj->product_buy_default_vat_code . ')' : ''), $mysoc, $mysoc, 0);
$rcc_compta_tva = (!empty($vatdata['accountancy_code_vat_reverse_charge_credit']) ? $vatdata['accountancy_code_vat_reverse_charge_credit'] : $rcctva);
$rcd_compta_tva = (!empty($vatdata['accountancy_code_vat_reverse_charge_debit']) ? $vatdata['accountancy_code_vat_reverse_charge_debit'] : $rcdtva);
$rcc_compta_localtax1 = (!empty($vatdata['accountancy_code_vat_reverse_charge_credit']) ? $vatdata['accountancy_code_vat_reverse_charge_credit'] : $rcctva);
$rcd_compta_localtax1 = (!empty($vatdata['accountancy_code_vat_reverse_charge_debit']) ? $vatdata['accountancy_code_vat_reverse_charge_debit'] : $rcdtva);
$rcc_compta_localtax2 = (!empty($vatdata['accountancy_code_vat_reverse_charge_credit']) ? $vatdata['accountancy_code_vat_reverse_charge_credit'] : $rcctva);
$rcd_compta_localtax2 = (!empty($vatdata['accountancy_code_vat_reverse_charge_debit']) ? $vatdata['accountancy_code_vat_reverse_charge_debit'] : $rcdtva);
if (price2num($obj->product_buy_vat) || !empty($obj->product_buy_default_vat_code)) {
$vat_key = vatrate($obj->product_buy_vat) . ($obj->product_buy_default_vat_code ? ' (' . $obj->product_buy_default_vat_code . ')' : '');
$val_value = $vat_key;
$def_tva[$obj->rowid][$rcc_compta_tva][$vat_key] = $val_value;
$def_tva[$obj->rowid][$rcd_compta_tva][$vat_key] = $val_value;
}
if (!isset($tabrctva[$obj->rowid][$rcc_compta_tva])) {
$tabrctva[$obj->rowid][$rcc_compta_tva] = 0;
}
if (!isset($tabrctva[$obj->rowid][$rcd_compta_tva])) {
$tabrctva[$obj->rowid][$rcd_compta_tva] = 0;
}
if (!isset($tabrclocaltax1[$obj->rowid][$rcc_compta_localtax1])) {
$tabrclocaltax1[$obj->rowid][$rcc_compta_localtax1] = 0;
}
if (!isset($tabrclocaltax1[$obj->rowid][$rcd_compta_localtax1])) {
$tabrclocaltax1[$obj->rowid][$rcd_compta_localtax1] = 0;
}
if (!isset($tabrclocaltax2[$obj->rowid][$rcc_compta_localtax2])) {
$tabrclocaltax2[$obj->rowid][$rcc_compta_localtax2] = 0;
}
if (!isset($tabrclocaltax2[$obj->rowid][$rcd_compta_localtax2])) {
$tabrclocaltax2[$obj->rowid][$rcd_compta_localtax2] = 0;
}
$rcvat = (double) price2num($obj->total_ttc * $obj->product_buy_vat / 100, 'MT');
$rclocalvat1 = (double) price2num($obj->total_ttc * $obj->product_buy_localvat1 / 100, 'MT');
$rclocalvat2 = (double) price2num($obj->total_ttc * $obj->product_buy_localvat2 / 100, 'MT');
$tabrctva[$obj->rowid][$rcd_compta_tva] += $rcvat;
$tabrctva[$obj->rowid][$rcc_compta_tva] -= $rcvat;
$tabrclocaltax1[$obj->rowid][$rcd_compta_localtax1] += $rclocalvat1;
$tabrclocaltax1[$obj->rowid][$rcc_compta_localtax1] -= $rclocalvat1;
$tabrclocaltax2[$obj->rowid][$rcd_compta_localtax2] += $rclocalvat2;
$tabrclocaltax2[$obj->rowid][$rcc_compta_localtax2] -= $rclocalvat2;
}
$tabttc[$obj->rowid][$compta_soc] += $obj->total_ttc;
$tabht[$obj->rowid][$compta_prod] += $obj->total_ht;
$tabtva[$obj->rowid][$compta_tva] += $obj->total_tva;
@ -470,6 +527,29 @@ if ($action == 'writebookkeeping') {
$arrayofvat = $tablocaltax2;
}
// VAT Reverse charge
if ($mysoc->country_code == 'FR' || !empty($conf->global->ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE)) {
$has_vat = false;
foreach ($arrayofvat[$key] as $k => $mt) {
if ($mt) {
$has_vat = true;
}
}
if (!$has_vat) {
$arrayofvat = $tabrctva;
if ($numtax == 1) {
$arrayofvat = $tabrclocaltax1;
}
if ($numtax == 2) {
$arrayofvat = $tabrclocaltax2;
}
if (!is_array($arrayofvat[$key])) {
$arrayofvat[$key] = array();
}
}
}
foreach ($arrayofvat[$key] as $k => $mt) {
if ($mt) {
$accountingaccount->fetch(null, $k, true); // TODO Use a cache for label
@ -720,6 +800,29 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
$arrayofvat = $tablocaltax2;
}
// VAT Reverse charge
if ($mysoc->country_code == 'FR' || !empty($conf->global->ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE)) {
$has_vat = false;
foreach ($arrayofvat[$key] as $k => $mt) {
if ($mt) {
$has_vat = true;
}
}
if (!$has_vat) {
$arrayofvat = $tabrctva;
if ($numtax == 1) {
$arrayofvat = $tabrclocaltax1;
}
if ($numtax == 2) {
$arrayofvat = $tabrclocaltax2;
}
if (!is_array($arrayofvat[$key])) {
$arrayofvat[$key] = array();
}
}
}
foreach ($arrayofvat[$key] as $k => $mt) {
if ($mt) {
print '"'.$key.'"'.$sep;
@ -998,6 +1101,29 @@ if (empty($action) || $action == 'view') {
$arrayofvat = $tablocaltax2;
}
// VAT Reverse charge
if ($mysoc->country_code == 'FR' || !empty($conf->global->ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE)) {
$has_vat = false;
foreach ($arrayofvat[$key] as $k => $mt) {
if ($mt) {
$has_vat = true;
}
}
if (!$has_vat) {
$arrayofvat = $tabrctva;
if ($numtax == 1) {
$arrayofvat = $tabrclocaltax1;
}
if ($numtax == 2) {
$arrayofvat = $tabrclocaltax2;
}
if (!is_array($arrayofvat[$key])) {
$arrayofvat[$key] = array();
}
}
}
foreach ($arrayofvat[$key] as $k => $mt) {
if ($mt) {
print '<tr class="oddeven">';

View File

@ -272,9 +272,10 @@ $object_label = $langs->trans("ObjectsRef");
if ($object->nature == 2 || $object->nature == 3) $object_label = $langs->trans("InvoiceRef");
if ($object->nature == 5) $object_label = $langs->trans("ExpenseReportRef");
/*
* Show result array
*/
// Show result array
$i = 0;
print '<br>';
print '<div class="div-table-responsive">';
@ -304,11 +305,21 @@ if (is_array($journal_data) && !empty($journal_data)) {
print '<td class="right nowraponall">' . $line['debit'] . '</td>';
print '<td class="right nowraponall">' . $line['credit'] . '</td>';
print '</tr>';
$i++;
}
}
}
}
if (!$i) {
$colspan = 7;
if ($object->nature == 4) {
$colspan++;
}
print '<tr class="oddeven"><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
}
print '</table>';
print '</div>';

View File

@ -83,6 +83,8 @@ if (!$sortfield) {
if (!$sortorder) {
if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE > 0) {
$sortorder = "DESC";
} else {
$sortorder = "ASC";
}
}
@ -164,6 +166,12 @@ if (is_array($changeaccount) && count($changeaccount) > 0 && $user->rights->acco
}
}
if (GETPOST('sortfield') == 'f.datef, f.ref, l.rowid') {
$value = (GETPOST('sortorder') == 'asc,asc,asc' ? 0 : 1);
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
$res = dolibarr_set_const($db, "ACCOUNTING_LIST_SORT_VENTILATION_DONE", $value, 'yesno', 0, '', $conf->entity);
}
/*
* View
@ -322,7 +330,7 @@ if ($result) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
$param .= '&limit='.((int) $limit);
}
if ($search_societe) {
$param .= "&search_societe=".urlencode($search_societe);

View File

@ -93,6 +93,8 @@ if (!$sortfield) {
if (!$sortorder) {
if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO > 0) {
$sortorder = "DESC";
} else {
$sortorder = "ASC";
}
}
@ -210,6 +212,11 @@ if ($massaction == 'ventil' && $user->rights->accounting->bind->write) {
}
}
if (GETPOST('sortfield') == 'f.datef, f.ref, l.rowid') {
$value = (GETPOST('sortorder') == 'asc,asc,asc' ? 0 : 1);
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
$res = dolibarr_set_const($db, "ACCOUNTING_LIST_SORT_VENTILATION_TODO", $value, 'yesno', 0, '', $conf->entity);
}
/*
@ -386,7 +393,7 @@ if ($result) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
$param .= '&limit='.((int) $limit);
}
if ($search_societe) {
$param .= '&search_societe='.urlencode($search_societe);

View File

@ -2413,8 +2413,7 @@ class Adherent extends CommonObject
}
// Only picto
if ($withpictoimg > 0) {
$picto = '<span class="nopadding'.($morecss ? ' userimg'.$morecss : '').'">'.
img_object('', 'user', $paddafterimage.' '.($notooltip ? '' : $dataparams.' class="'.$classfortooltip.'"'), 0, 0, $notooltip ? 0 : 1).'</span>';
$picto = '<span class="nopadding'.($morecss ? ' userimg'.$morecss : '').'">'.img_object('', 'user', $paddafterimage.' '.($notooltip ? '' : $dataparams), 0, 0, $notooltip ? 0 : 1).'</span>';
} else {
// Picto must be a photo
$picto = '<span class="nopadding'.($morecss ? ' userimg'.$morecss : '').'"'.($paddafterimage ? ' '.$paddafterimage : '').'>';

View File

@ -774,7 +774,7 @@ class AdherentType extends CommonObject
$result .= $linkstart;
if ($withpicto) {
$result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : $dataparams.' class="'.(($withpicto != 2) ? 'paddingright ' : '').$classfortooltip.'"'), 0, 0, $notooltip ? 0 : 1);
$result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), (' class="'.(($withpicto != 2) ? 'paddingright' : '').'"'), 0, 0, $notooltip ? 0 : 1);
}
if ($withpicto != 2) {
$result .= ($maxlen ?dol_trunc($this->label, $maxlen) : $this->label);

View File

@ -452,10 +452,10 @@ class Subscription extends CommonObject
/**
* Retourne le libelle du statut d'une adhesion
* Return the label of the status
*
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Label
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function getLibStatut($mode = 0)
{
@ -464,16 +464,19 @@ class Subscription extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoi le libelle d'un statut donne
* Return the label of a given status
*
* @param int $status Id status
* @return string Label
* @param int $status Id status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function LibStatut($status)
public function LibStatut($status, $mode = 0)
{
// phpcs:enable
global $langs;
$langs->load("members");
//$langs->load("members");
return '';
}

View File

@ -188,7 +188,8 @@ $result = restrictedArea($user, 'adherent');
*/
if (GETPOST('cancel', 'alpha')) {
$action = 'list'; $massaction = '';
$action = 'list';
$massaction = '';
}
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
$massaction = '';
@ -324,14 +325,17 @@ $formother = new FormOther($db);
$membertypestatic = new AdherentType($db);
$memberstatic = new Adherent($db);
$now = dol_now();
// Page Header
$title = $langs->trans("Members")." - ".$langs->trans("List");
$help_url = 'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros|DE:Modul_Mitglieder';
llxHeader('', $title, $help_url);
$morejs = array();
$morecss = array();
$now = dol_now();
// Build and execute select
// --------------------------------------------------------------------
if ((!empty($search_categ) && $search_categ > 0) || !empty($catid)) {
$sql = "SELECT DISTINCT";
} else {
@ -356,7 +360,7 @@ if (!empty($extrafields->attributes[$object->table_element]['label'])) {
// Add fields from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
$sql = preg_replace('/,\s*$/', '', $sql);
@ -487,16 +491,14 @@ if ($search_country) {
if ($search_import_key) {
$sql .= natural_search("d.import_key", $search_import_key);
}
// Add where from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
// Add where from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
// Count total nb of records with no order and no limits
// Count total nb of records
$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
/* The fast and low memory method to get and count full list converts the sql into a sql count */
@ -510,7 +512,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
dol_print_error($db);
}
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller than the paging size (filtering), goto and load page 0
$page = 0;
$offset = 0;
}
@ -533,8 +535,7 @@ if (!$resql) {
$num = $db->num_rows($resql);
$arrayofselected = is_array($toselect) ? $toselect : array();
// Direct jump if only one record found
if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall) {
$obj = $db->fetch_object($resql);
$id = $obj->rowid;
@ -542,6 +543,13 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $
exit;
}
// Output page
// --------------------------------------------------------------------
llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'bodyforlist'); // Can use also classforhorizontalscrolloftabs instead of bodyforlist for no horizontal scroll
$arrayofselected = is_array($toselect) ? $toselect : array();
if ($search_type > 0) {
$membertype = new AdherentType($db);
@ -558,7 +566,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
$param .= '&limit='.((int) $limit);
}
if ($sall != "") {
$param .= "&sall=".urlencode($sall);
@ -1351,7 +1359,7 @@ if ($num == 0) {
$colspan++;
}
}
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
}
$db->free($resql);

View File

@ -451,7 +451,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
$param .= '&limit='.((int) $limit);
}
$param .= '&id='.$rowid;
if ($optioncss != '') {

View File

@ -55,6 +55,7 @@ $error = 0;
$title = $langs->trans("ConfigAccountingExpert");
$help_url = '';
llxHeader('', $title, $help_url);
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';

View File

@ -226,7 +226,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
$param .= '&limit='.((int) $limit);
}
if ($optioncss != '') {
$param .= '&optioncss='.urlencode($optioncss);

View File

@ -603,7 +603,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Filters
print '<div class="div-table-responsive-no-min">';
print '<table id="tablelineoffilters" class="noborder margintable noshadow">';
print '<table id="tablelineoffilters" class="noborder nobordertop noshadow">';
print '<tr class="liste_titre nodrag nodrop">';
print '<td>'.img_picto('', 'filter', 'class="pictofixedwidth opacitymedium"').$form->textwithpicto($langs->trans("Filters"), $langs->trans("EmailCollectorFilterDesc")).'</td><td></td><td></td>';
print '</tr>';
@ -615,20 +615,19 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
'to'=>array('label'=>'MailTo', 'data-placeholder'=>$langs->trans('SearchString')),
'cc'=>array('label'=>'Cc', 'data-placeholder'=>$langs->trans('SearchString')),
'bcc'=>array('label'=>'Bcc', 'data-placeholder'=>$langs->trans('SearchString')),
'replyto'=>array('label'=>'ReplyTo', 'data-placeholder'=>$langs->trans('SearchString')),
'subject'=>array('label'=>'Subject', 'data-placeholder'=>$langs->trans('SearchString')),
'body'=>array('label'=>'Body', 'data-placeholder'=>$langs->trans('SearchString')),
// disabled because PHP imap_search is not compatible IMAPv4, only IMAPv2
//'header'=>array('label'=>'Header', 'data-placeholder'=>'HeaderKey SearchString'), // HEADER key value
//'X1'=>'---',
//'notinsubject'=>array('label'=>'SubjectNotIn', 'data-placeholder'=>'SearchString'),
//'notinbody'=>array('label'=>'BodyNotIn', 'data-placeholder'=>'SearchString'),
'X2'=>'---',
'seen'=>array('label'=>'AlreadyRead', 'data-noparam'=>1),
'unseen'=>array('label'=>'NotRead', 'data-noparam'=>1),
'unanswered'=>array('label'=>'Unanswered', 'data-noparam'=>1),
'answered'=>array('label'=>'Answered', 'data-noparam'=>1),
'smaller'=>array('label'=>'SmallerThan', 'data-placeholder'=>$langs->trans('NumberOfBytes')),
'larger'=>array('label'=>'LargerThan', 'data-placeholder'=>$langs->trans('NumberOfBytes')),
'smaller'=>array('label'=>$langs->trans("Size").' ('.$langs->trans("SmallerThan").")", 'data-placeholder'=>$langs->trans('NumberOfBytes')),
'larger'=>array('label'=>$langs->trans("Size").' ('.$langs->trans("LargerThan").")", 'data-placeholder'=>$langs->trans('NumberOfBytes')),
'X3'=>'---',
'withtrackingid'=>array('label'=>'WithDolTrackingID', 'data-noparam'=>1),
'withouttrackingid'=>array('label'=>'WithoutDolTrackingID', 'data-noparam'=>1),
@ -662,7 +661,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '</td><td>';
print '<input type="text" name="rulevalue" id="rulevalue">';
print '</td>';
print '<td class="right"><input type="submit" name="addfilter" id="addfilter" class="flat button small" value="'.$langs->trans("Add").'"></td>';
print '<td class="right"><input type="submit" name="addfilter" id="addfilter" class="flat button smallpaddingimp" value="'.$langs->trans("Add").'"></td>';
print '</tr>';
// List filters
foreach ($object->filters as $rulefilter) {
@ -690,7 +689,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '<div class="div-table-responsive-no-min">';
print '<table id="tablelines" class="noborder noshadow">';
print '<tr class="liste_titre nodrag nodrop">';
print '<td>'.img_picto('', 'technic', 'class="pictofixedwidth"').$form->textwithpicto($langs->trans("EmailcollectorOperations"), $langs->trans("EmailcollectorOperationsDesc")).'</td><td></td><td></td><td></td>';
print '<td>'.img_picto('', 'technic', 'class="pictofixedwidth"').$form->textwithpicto($langs->trans("EmailcollectorOperations"), $langs->trans("EmailcollectorOperationsDesc")).'</td>';
print '<td>';
$htmltext = $langs->transnoentitiesnoconv("OperationParamDesc");
print $form->textwithpicto($langs->trans("Parameters"), $htmltext, 1, 'help', '', 0, 2, 'operationparamtt');
print '</td>';
print '<td></td>';
print '<td></td>';
print '</tr>';
$arrayoftypes = array(
@ -730,13 +735,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '<td>';
print $form->selectarray('operationtype', $arrayoftypes, '', 1, 0, 0, '', 1, 0, 0, '', 'minwidth150 maxwidth300', 1);
print '</td><td>';
//print '<input type="text" name="operationparam">';
$htmltext = $langs->transnoentitiesnoconv("OperationParamDesc");
print $form->textwithpicto('<input type="text" name="operationparam">', $htmltext, 1, 'help', '', 0, 2, 'operationparamtt');
print '<textarea class="centpercent" name="operationparam" rows="3"></textarea>';
print '</td>';
print '<td>';
print '</td>';
print '<td class="right"><input type="submit" name="addoperation" id="addoperation" class="flat button small" value="'.$langs->trans("Add").'"></td>';
print '<td class="right"><input type="submit" name="addoperation" id="addoperation" class="flat button smallpaddingimp" value="'.$langs->trans("Add").'"></td>';
print '</tr>';
// List operations
$nboflines = count($object->actions);
@ -766,12 +769,15 @@ 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="'.dol_escape_htmltag($ruleaction['actionparam']).'"><br>';
//print '<input type="text" class="quatrevingtquinzepercent" name="operationparam2" value="'.dol_escape_htmltag($ruleaction['actionparam']).'"><br>';
print '<textarea class="centpercent" name="operationparam2" rows="3">';
print dol_escape_htmltag($ruleaction['actionparam'], 0, 1);
print '</textarea>';
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 dol_escape_htmltag($ruleaction['actionparam']);
print dol_nl2br(dol_escape_htmltag($ruleaction['actionparam'], 0, 1));
}
print '</td>';
// Move up/down

View File

@ -337,7 +337,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
$param .= '&limit='.((int) $limit);
}
foreach ($search as $key => $val) {
if (is_array($search[$key]) && count($search[$key])) {

View File

@ -334,7 +334,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
$param .= '&limit='.((int) $limit);
}
foreach ($search as $key => $val) {
if (is_array($search[$key]) && count($search[$key])) {
@ -627,7 +627,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
print '<td class="nowrap center">';
$url = $_SERVER["PHP_SELF"].'?id='.$obj->rowid;
if ($limit) {
$url .= '&limit='.urlencode($limit);
$url .= '&limit='.((int) $limit);
}
if ($page) {
$url .= '&page='.urlencode($page);

View File

@ -623,7 +623,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
$param .= '&limit='.((int) $limit);
}
if (!empty($search) && is_array($search)) {
foreach ($search as $key => $val) {

View File

@ -478,7 +478,7 @@ if ($mode == 'feature') {
if (isset($objMod->module_parts) && isset($objMod->module_parts['triggers']) && $objMod->module_parts['triggers']) {
$yesno = 'Yes';
} else {
$yesno = 'No';
$yesno = '<span class="opacitymedium">No</span>';
}
require_once DOL_DOCUMENT_ROOT.'/core/class/interfaces.class.php';
$interfaces = new Interfaces($db);

View File

@ -231,7 +231,7 @@ if ($action == 'install') {
if (!$error) {
@dol_delete_dir_recursive($dirins.'/'.$modulenameval); // delete the target directory
$submodulenamedir = $conf->admin->dir_temp.'/'.$tmpdir.'/'.$modulenameval;
if (!dol_is_dir($modulenamedir)) {
if (!dol_is_dir($submodulenamedir)) {
$submodulenamedir = $conf->admin->dir_temp.'/'.$tmpdir.'/htdocs/'.$modulenameval;
}
dol_syslog("We copy now directory ".$submodulenamedir." into target dir ".$dirins.'/'.$modulenameval);
@ -476,7 +476,7 @@ foreach ($modulesdir as $dir) {
dol_syslog("Module ".get_class($objMod)." not qualified");
}
} else {
print "Warning bad descriptor file : ".$dir.$file." (Class ".$modName." not found into file)<br>";
print "admin/modules.php Warning bad descriptor file : ".$dir.$file." (Class ".$modName." not found into file)<br>";
}
} catch (Exception $e) {
dol_syslog("Failed to load ".$dir.$file." ".$e->getMessage(), LOG_ERR);

View File

@ -181,16 +181,25 @@ $formproduct = new FormProduct($db);
$disabled = '';
if (isModEnabled('productbatch')) {
// If module lot/serial enabled, we force the inc/dec mode to STOCK_CALCULATE_ON_SHIPMENT_CLOSE and STOCK_CALCULATE_ON_RECEPTION_CLOSE
$langs->load("productbatch");
$disabled = ' disabled';
print info_admin($langs->trans("WhenProductBatchModuleOnOptionAreForced"));
// STOCK_CALCULATE_ON_SHIPMENT_CLOSE
$descmode = $langs->trans('DeStockOnShipmentOnClosing');
if (!isModEnabled('reception')) {
// STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER
$incmode = $langs->trans('ReStockOnDispatchOrder');
} else {
// STOCK_CALCULATE_ON_RECEPTION_CLOSE
$incmode = $langs->trans('StockOnReceptionOnClosing');
}
print info_admin($langs->trans("WhenProductBatchModuleOnOptionAreForced", $descmode, $incmode));
}
//if (!empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) || !empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT))
//{
print info_admin($langs->trans("IfYouUsePointOfSaleCheckModule"));
print '<br>';
//}
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
@ -221,7 +230,7 @@ if (isModEnabled('facture')) {
print $form->selectarray("STOCK_CALCULATE_ON_BILL", $arrval, $conf->global->STOCK_CALCULATE_ON_BILL);
}
} else {
print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module30Name"));
print '<span class="opacitymedium">'.$langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module30Name")).'</span>';
}
print "</td>\n</tr>\n";
$found++;
@ -242,7 +251,7 @@ if (isModEnabled('commande')) {
print $form->selectarray("STOCK_CALCULATE_ON_VALIDATE_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER);
}
} else {
print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module25Name"));
print '<span class="opacitymedium">'.$langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module25Name")).'</span>';
}
print "</td>\n</tr>\n";
$found++;
@ -261,7 +270,7 @@ if (isModEnabled("expedition")) {
print $form->selectarray("STOCK_CALCULATE_ON_SHIPMENT", $arrval, $conf->global->STOCK_CALCULATE_ON_SHIPMENT);
}
} else {
print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module80Name"));
print '<span class="opacitymedium">'.$langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module80Name")).'</span>';
}
print "</td>\n</tr>\n";
$found++;
@ -278,7 +287,7 @@ if (isModEnabled("expedition")) {
print $form->selectarray("STOCK_CALCULATE_ON_SHIPMENT_CLOSE", $arrval, $conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE);
}
} else {
print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module80Name"));
print '<span class="opacitymedium">'.$langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module80Name")).'</span>';
}
print "</td>\n</tr>\n";
$found++;
@ -313,7 +322,7 @@ if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMO
print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_BILL", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL);
}
} else {
print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module40Name"));
print '<span class="opacitymedium">'.$langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module40Name")).'</span>';
}
print "</td>\n</tr>\n";
$found++;
@ -335,7 +344,7 @@ if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMO
print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER);
}
} else {
print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module40Name"));
print '<span class="opacitymedium">'.$langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module40Name")).'</span>';
}
print "</td>\n</tr>\n";
$found++;
@ -380,7 +389,7 @@ if (isModEnabled("reception")) {
print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER);
}
} else {
print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module40Name"));
print '<span class="opacitymedium">'.$langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module40Name")).'</span>';
}
print "</td>\n</tr>\n";
$found++;

View File

@ -601,6 +601,9 @@ print '<br>';
print '<strong>MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES</strong> = '.getDolGlobalString('MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES', '<span class="opacitymedium">'.$langs->trans("Undefined").' &nbsp; ('.$langs->trans("Recommended").': 1)</span>')."<br>";
print '<br>';
print '<strong>MAIN_DISALLOW_EXT_URL_INTO_DESCRIPTIONS</strong> = '.getDolGlobalString('MAIN_DISALLOW_EXT_URL_INTO_DESCRIPTIONS', '<span class="opacitymedium">'.$langs->trans("Undefined").' &nbsp; ('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or").' 0)</span>')."<br>";
print '<br>';
print '<strong>MAIN_SECURITY_CSRF_TOKEN_RENEWAL_ON_EACH_CALL</strong> = '.getDolGlobalString('MAIN_SECURITY_CSRF_TOKEN_RENEWAL_ON_EACH_CALL', '<span class="opacitymedium">'.$langs->trans("Undefined").' &nbsp; ('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or").' 0)</span>')."<br>";
print '<br>';

View File

@ -259,7 +259,7 @@ if ($result) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
$param .= '&limit='.((int) $limit);
}
if ($optioncss != '') {
$param .= '&optioncss='.urlencode($optioncss);

View File

@ -226,7 +226,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
$param .= '&limit='.((int) $limit);
}
if (isset($optioncss) && $optioncss != '') {
$param .= '&optioncss='.urlencode($optioncss);

View File

@ -197,7 +197,7 @@ if ($object->id > 0) {
$param .= '&contextpage=' . urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit=' . urlencode($limit);
$param .= '&limit='.((int) $limit);
}

View File

@ -354,7 +354,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
$param .= '&limit='.((int) $limit);
}
foreach ($search as $key => $val) {
if (is_array($search[$key]) && count($search[$key])) {

View File

@ -199,7 +199,7 @@ if ($object->id > 0) {
// $param .= '&contextpage=' . urlencode($contextpage);
// }
// if ($limit > 0 && $limit != $conf->liste_limit) {
// $param .= '&limit=' . urlencode($limit);
// $param .= '&limit='.((int) $limit);
// }
//
//

View File

@ -360,7 +360,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
$param .= '&limit='.((int) $limit);
}
foreach ($search as $key => $val) {
if (is_array($search[$key]) && count($search[$key])) {

View File

@ -325,7 +325,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
$param .= '&limit='.((int) $limit);
}
if ($search_id != '') {
$param .= '&search_id='.urlencode($search_id);

View File

@ -241,7 +241,7 @@ if ($object->id > 0) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
$param .= '&limit='.((int) $limit);
}

View File

@ -442,7 +442,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
$param .= '&limit='.((int) $limit);
}
foreach ($search as $key => $val) {
if (is_array($search[$key])) {

View File

@ -1168,7 +1168,7 @@ class BOM extends CommonObject
$result .= $linkstart;
if ($withpicto) {
$result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : $dataparams.' class="'.(($withpicto != 2) ? 'paddingright ' : '').$classfortooltip.'"'), 0, 0, $notooltip ? 0 : 1);
$result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), (($withpicto != 2) ? 'class="paddingright"' : ''), 0, 0, $notooltip ? 0 : 1);
}
if ($withpicto != 2) {
$result .= $this->ref;

View File

@ -247,7 +247,7 @@ if ($object->id > 0) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
$param .= '&limit='.((int) $limit);
}

View File

@ -396,7 +396,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
$param .= '&limit='.((int) $limit);
}
foreach ($search as $key => $val) {
if (is_array($search[$key]) && count($search[$key])) {

View File

@ -247,7 +247,7 @@ if ($object->id > 0) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
$param .= '&limit='.((int) $limit);
}

View File

@ -396,7 +396,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
$param .= '&limit='.((int) $limit);
}
foreach ($search as $key => $val) {
if (is_array($search[$key]) && count($search[$key])) {

View File

@ -268,10 +268,10 @@ class Bookmark extends CommonObject
}
/**
* Return label of contact status
* Return the label of the status
*
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Label of contact status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function getLibStatut($mode)
{

View File

@ -221,7 +221,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
$param .= '&limit='.((int) $limit);
}
if ($optioncss != '') {
$param .= '&optioncss='.urlencode($optioncss);

View File

@ -1666,7 +1666,7 @@ class ActionComm extends CommonObject
}
$canread = 0;
if (!empty($user->rights->agenda->myactions->read) && $this->authorid == $user->id) {
if ($user->hasRight('agenda', 'myactions', 'read') && ($this->authorid == $user->id || $this->userownerid == $user->id)) {
$canread = 1; // Can read my event
}
if (!empty($user->rights->agenda->myactions->read) && array_key_exists($user->id, $this->userassigned)) {

View File

@ -301,7 +301,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
$param .= '&limit='.((int) $limit);
}
if ($actioncode != '') {
if (is_array($actioncode)) {
@ -934,6 +934,7 @@ while ($i < $imaxinloop) {
$actionstatic->datep = $db->jdate($obj->dp);
$actionstatic->percentage = $obj->percent;
$actionstatic->authorid = $obj->fk_user_author;
$actionstatic->userownerid = $obj->fk_user_action;
// Initialize $this->userassigned && this->socpeopleassigned array && this->userownerid
// but only if we need it

View File

@ -40,7 +40,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
// Load translation files required by the page
$langs->load("mails");
$langs->loadLangs(array("mails"));
$id = (GETPOST('mailid', 'int') ? GETPOST('mailid', 'int') : GETPOST('id', 'int'));
@ -48,20 +48,18 @@ $action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha');
$cancel = GETPOST('cancel', 'aZ09');
$urlfrom = GETPOST('urlfrom');
$backtopageforcancel = GETPOST('backtopageforcancel');
// Initialize technical objects
$object = new Mailing($db);
$extrafields = new ExtraFields($db);
if ($id > 0) {
$result = $object->fetch($id);
}
$hookmanager->initHooks(array('mailingcard', 'globalcard'));
// Fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label($object->table_element);
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('mailingcard', 'globalcard'));
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
// Array of possible substitutions (See also file mailing-send.php that should manage same substitutions)
$object->substitutionarray = FormMail::getAvailableSubstitKey('emailing');
@ -86,10 +84,14 @@ $listofmethods['smtps'] = 'SMTP/SMTPS socket library';
if (empty($user->rights->mailing->lire) || (empty($conf->global->EXTERNAL_USERS_ARE_AUTHORIZED) && $user->socid > 0)) {
accessforbidden();
}
if (empty($action) && empty($object->id)) {
accessforbidden('Object not found');
}
$upload_dir = $conf->mailing->dir_output."/".get_exdir($object->id, 2, 0, 1, $object, 'mailing');
/*
* Actions
*/
@ -567,7 +569,7 @@ if (empty($reshook)) {
}
// Action update description of emailing
if ($action == 'settitle' || $action == 'setemail_from' || $action == 'setreplyto' || $action == 'setemail_errorsto') {
if ($action == 'settitle' || $action == 'setemail_from' || $action == 'setreplyto' || $action == 'setemail_errorsto' || $action == 'setevenunsubscribe') {
$upload_dir = $conf->mailing->dir_output."/".get_exdir($object->id, 2, 0, 1, $object, 'mailing');
if ($action == 'settitle') {
@ -582,10 +584,13 @@ if (empty($reshook)) {
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentities("MailTitle"));
} elseif ($action == 'setfrom' && empty($object->email_from)) {
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentities("MailFrom"));
} elseif ($action == 'setevenunsubscribe') {
$object->evenunsubscribe = (GETPOST('evenunsubscribe') ? 1 : 0);
}
if (!$mesg) {
if ($object->update($user) >= 0) {
$result = $object->update($user);
if ($result >= 0) {
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
exit;
}
@ -747,20 +752,21 @@ llxHeader(
array()
);
if ($action == 'create') {
// EMailing in creation mode
print '<form name="new_mailing" action="'.$_SERVER['PHP_SELF'].'" method="POST">'."\n";
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="add">';
$htmltext = '<i>'.$langs->trans("FollowingConstantsWillBeSubstituted").':<br>';
$htmltext = '<i>'.$langs->trans("FollowingConstantsWillBeSubstituted").':<br><br><span class="small">';
foreach ($object->substitutionarray as $key => $val) {
$htmltext .= $key.' = '.$langs->trans($val).'<br>';
}
$htmltext .= '</i>';
$htmltext .= '</span></i>';
$availablelink = $form->textwithpicto($langs->trans("AvailableVariables"), $htmltext, 1, 'help', '', 0, 2, 'availvar');
$availablelink = $form->textwithpicto('<span class="opacitymedium">'.$langs->trans("AvailableVariables").'</span>', $htmltext, 1, 'help', '', 0, 2, 'availvar');
//print '<a href="javascript:document_preview(\''.DOL_URL_ROOT.'/admin/modulehelp.php?id='.$objMod->numero.'\',\'text/html\',\''.dol_escape_js($langs->trans("Module")).'\')">'.img_picto($langs->trans("ClickToShowDescription"), $imginfo).'</a>';
@ -931,18 +937,9 @@ if ($action == 'create') {
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright);
print '<div class="fichecenter">';
print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent tableforfield">';
// Description
/*
print '<tr><td class="titlefield">';
print $form->editfieldkey("MailTitle", 'title', $object->title, $object, $user->hasRight('mailing', 'creer'), 'string');
print '</td><td>';
print $form->editfieldval("MailTitle", 'title', $object->title, $object, $user->hasRight('mailing', 'creer'), 'string');
print '</td></tr>';
*/
print '<table class="border centpercent tableforfield">'."\n";
// From
print '<tr><td class="titlefield">';
@ -975,10 +972,18 @@ if ($action == 'create') {
}
print '</td></tr>';
print '</table>';
print '</div>';
print '<div class="fichehalfright">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent tableforfield">';
// Number of distinct emails
print '<tr><td>';
print '<tr><td class="titlefield">';
print $langs->trans("TotalNbOfDistinctRecipients");
print '</td><td colspan="3">';
print '</td><td>';
$nbemail = ($object->nbemail ? $object->nbemail : 0);
if (is_numeric($nbemail)) {
$text = '';
@ -1000,12 +1005,14 @@ if ($action == 'create') {
}
print '</td></tr>';
// Other attributes
// Other attributes. Fields from hook formObjectOptions and Extrafields.
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
print '</table>';
print '</div>';
print '</div>';
print "</div>";
print '<div class="clearboth"></div>';
print dol_get_fiche_end();
@ -1022,11 +1029,8 @@ if ($action == 'create') {
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneEMailing', $object->ref), 'confirm_clone', $formquestion, 'yes', 2, 240);
}
/*
* Actions Buttons
*/
if (GETPOST('cancel', 'alpha') || $confirm == 'no' || $action == '' || in_array($action, array('settodraft', 'valid', 'delete', 'sendall', 'clone', 'test'))) {
// Actions Buttons
if (GETPOST('cancel', 'alpha') || $confirm == 'no' || $action == '' || in_array($action, array('settodraft', 'valid', 'delete', 'sendall', 'clone', 'test', 'editevenunsubscribe'))) {
print "\n\n<div class=\"tabsAction\">\n";
if (($object->statut == 1) && ($user->hasRight('mailing', 'valider') || $object->user_validation == $user->id)) {
@ -1198,17 +1202,32 @@ if ($action == 'create') {
$linkback = '<a href="'.DOL_URL_ROOT.'/comm/mailing/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
$morehtmlref = '<div class="refidno">';
// Ref customer
$morehtmlref .= $form->editfieldkey("", 'title', $object->title, $object, $user->hasRight('mailing', 'creer'), 'string', '', 0, 1);
$morehtmlref .= $form->editfieldval("", 'title', $object->title, $object, $user->hasRight('mailing', 'creer'), 'string', '', null, null, '', 1);
$morehtmlref .= '</div>';
$morehtmlright = '';
if ($object->statut == 2) {
$morehtmlright .= ' ('.$object->countNbOfTargets('alreadysent').'/'.$object->nbemail.') ';
$nbtry = $nbok = 0;
if ($object->statut == 2 || $object->statut == 3) {
$nbtry = $object->countNbOfTargets('alreadysent');
$nbko = $object->countNbOfTargets('alreadysentko');
$morehtmlright .= ' ('.$nbtry.'/'.$object->nbemail;
if ($nbko) {
$morehtmlright .= ' - '.$nbko.' '.$langs->trans("Error");
}
$morehtmlright .= ') &nbsp; ';
}
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '', '', 0, '', $morehtmlright);
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright);
print '<div class="fichecenter">';
print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">';
print '<table class="border centpercent tableforfield">';
/*
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td>';
@ -1217,13 +1236,20 @@ if ($action == 'create') {
print '</td></tr>';
*/
// Topic
print '<tr><td class="titlefield">'.$langs->trans("MailTitle").'</td><td colspan="3">'.$object->title.'</td></tr>';
// From
print '<tr><td class="titlefield">'.$langs->trans("MailFrom").'</td><td colspan="3">'.dol_print_email($object->email_from, 0, 0, 0, 0, 1).'</td></tr>';
// To
print '<tr><td>'.$langs->trans("MailErrorsTo").'</td><td colspan="3">'.dol_print_email($object->email_errorsto, 0, 0, 0, 0, 1).'</td></tr>';
print '</table>';
print '</div>';
print '<div class="fichehalfright">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent tableforfield">';
// Number of distinct emails
print '<tr><td>';
print $langs->trans("TotalNbOfDistinctRecipients");
@ -1259,30 +1285,32 @@ if ($action == 'create') {
print '</table>';
print '</div>';
print '</div>';
print '<div class="clearboth"></div>';
print dol_get_fiche_end();
print "<br>\n";
print "<br><br>\n";
print '<form name="edit_mailing" action="card.php" method="post" enctype="multipart/form-data">'."\n";
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="update">';
print '<input type="hidden" name="id" value="'.$object->id.'">';
$htmltext = '<i>'.$langs->trans("FollowingConstantsWillBeSubstituted").':<br>';
$htmltext = '<i>'.$langs->trans("FollowingConstantsWillBeSubstituted").':<br><br><span class="small">';
foreach ($object->substitutionarray as $key => $val) {
$htmltext .= $key.' = '.$langs->trans($val).'<br>';
}
$htmltext .= '</i>';
$htmltext .= '</span></i>';
// Print mail content
print load_fiche_titre($langs->trans("EMail"), $form->textwithpicto($langs->trans("AvailableVariables"), $htmltext, 1, 'help', '', 0, 2, 'emailsubstitionhelp'), 'generic');
print load_fiche_titre($langs->trans("EMail"), '<span class="opacitymedium">'.$form->textwithpicto($langs->trans("AvailableVariables").'</span>', $htmltext, 1, 'help', '', 0, 2, 'emailsubstitionhelp'), 'generic');
print dol_get_fiche_head(null, '', '', -1);
print '<table class="bordernooddeven" width="100%">';
print '<table class="bordernooddeven centpercent">';
// Subject
print '<tr><td class="fieldrequired titlefield">'.$langs->trans("MailTopic").'</td><td colspan="3"><input class="flat quatrevingtpercent" type="text" name="sujet" value="'.$object->sujet.'"></td></tr>';
@ -1336,6 +1364,7 @@ if ($action == 'create') {
print '</table>';
// Message
print '<div style="padding-top: 10px">';

View File

@ -32,6 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmailing.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/emailing.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
// Load translation files required by the page
$langs->load("mails");
@ -99,14 +100,22 @@ if ($action == 'add' && $user->hasRight('mailing', 'creer')) { // Add recipient
$classname = "mailing_".$module;
if (file_exists($file)) {
require_once $file;
include_once $file;
// Add targets into database
$obj = new $classname($db);
dol_syslog("Call add_to_target on class ".$classname);
$result = $obj->add_to_target($id);
dol_syslog("Call add_to_target() on class ".$classname." evenunsubscribe=".$object->evenunsubscribe);
$sqlmessage = $obj->sql;
if (class_exists($classname)) {
$obj = new $classname($db);
$obj->evenunsubscribe = $object->evenunsubscribe;
$result = $obj->add_to_target($id);
$sqlmessage = $obj->sql;
} else {
$result = -1;
break;
}
}
}
if ($result > 0) {
@ -198,6 +207,38 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
$search_dest_status = '';
}
// Action update description of emailing
if ($action == 'settitle' || $action == 'setemail_from' || $action == 'setreplyto' || $action == 'setemail_errorsto' || $action == 'setevenunsubscribe') {
$upload_dir = $conf->mailing->dir_output."/".get_exdir($object->id, 2, 0, 1, $object, 'mailing');
if ($action == 'settitle') {
$object->title = trim(GETPOST('title', 'alpha'));
} elseif ($action == 'setemail_from') {
$object->email_from = trim(GETPOST('email_from', 'alphawithlgt')); // Must allow 'name <email>'
} elseif ($action == 'setemail_replyto') {
$object->email_replyto = trim(GETPOST('email_replyto', 'alphawithlgt')); // Must allow 'name <email>'
} elseif ($action == 'setemail_errorsto') {
$object->email_errorsto = trim(GETPOST('email_errorsto', 'alphawithlgt')); // Must allow 'name <email>'
} elseif ($action == 'settitle' && empty($object->title)) {
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentities("MailTitle"));
} elseif ($action == 'setfrom' && empty($object->email_from)) {
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentities("MailFrom"));
} elseif ($action == 'setevenunsubscribe') {
$object->evenunsubscribe = (GETPOST('evenunsubscribe') ? 1 : 0);
}
if (!$mesg) {
$result = $object->update($user);
if ($result >= 0) {
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
exit;
}
$mesg = $object->error;
}
setEventMessages($mesg, null, 'errors');
$action = "";
}
/*
@ -224,7 +265,7 @@ if ($object->fetch($id) >= 0) {
$morehtmlright = '';
$nbtry = $nbok = 0;
if ($object->statut == 2 || $object->statut == 3) {
if ($object->statut == $object::STATUS_SENTPARTIALY || $object->statut == $object::STATUS_SENTCOMPLETELY) {
$nbtry = $object->countNbOfTargets('alreadysent');
$nbko = $object->countNbOfTargets('alreadysentko');
$nbok = ($nbtry - $nbko);
@ -239,13 +280,12 @@ if ($object->fetch($id) >= 0) {
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright);
print '<div class="fichecenter">';
print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent tableforfield">';
//print '<tr><td class="titlefield">'.$langs->trans("MailTitle").'</td><td colspan="3">'.$object->title.'</td></tr>';
print '<tr><td class="titlefield">'.$langs->trans("MailFrom").'</td><td colspan="3">';
print '<tr><td class="titlefield">'.$langs->trans("MailFrom").'</td><td>';
$emailarray = CMailFile::getArrayAddress($object->email_from);
foreach ($emailarray as $email => $name) {
if ($name && $name != $email) {
@ -264,7 +304,7 @@ if ($object->fetch($id) >= 0) {
print '</td></tr>';
// Errors to
print '<tr><td>'.$langs->trans("MailErrorsTo").'</td><td colspan="3">';
print '<tr><td>'.$langs->trans("MailErrorsTo").'</td><td>';
$emailarray = CMailFile::getArrayAddress($object->email_errorsto);
foreach ($emailarray as $email => $name) {
if ($name != $email) {
@ -280,10 +320,19 @@ if ($object->fetch($id) >= 0) {
}
print '</td></tr>';
// Nb of distinct emails
print '<tr><td>';
print '</table>';
print '</div>';
print '<div class="fichehalfright">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent tableforfield">';
// Number of distinct emails
print '<tr><td class="titlefield">';
print $langs->trans("TotalNbOfDistinctRecipients");
print '</td><td colspan="3">';
print '</td><td>';
$nbemail = ($object->nbemail ? $object->nbemail : 0);
if (is_numeric($nbemail)) {
$text = '';
@ -295,7 +344,7 @@ if ($object->fetch($id) >= 0) {
}
}
if (empty($nbemail)) {
$nbemail .= ' '.img_warning('');//.' <span class="warning">'.$langs->trans("NoTargetYet").'</span>';
$nbemail .= ' '.img_warning($langs->trans('ToAddRecipientsChooseHere'));//.' <span class="warning">'.$langs->trans("NoTargetYet").'</span>';
}
if ($text) {
print $form->textwithpicto($nbemail, $text, 1, 'warning');
@ -305,16 +354,21 @@ if ($object->fetch($id) >= 0) {
}
print '</td></tr>';
print '</table>';
// Other attributes. Fields from hook formObjectOptions and Extrafields.
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
print "</div>";
print '</table>';
print '</div>';
print '</div>';
print '<div class="clearboth"></div>';
print dol_get_fiche_end();
print '<br>';
$allowaddtarget = ($object->statut == 0);
$allowaddtarget = ($object->statut == $object::STATUS_DRAFT);
// Show email selectors
if ($allowaddtarget && $user->rights->mailing->creer) {
@ -327,7 +381,11 @@ if ($object->fetch($id) >= 0) {
print '<div class="tagtd"></div>';
print '<div class="tagtd">'.$langs->trans("RecipientSelectionModules").'</div>';
print '<div class="tagtd" align="center">'.$langs->trans("NbOfUniqueEMails").'</div>';
print '<div class="tagtd left">'.$langs->trans("Filter").'</div>';
print '<div class="tagtd left">'.$langs->trans("Filters");
print ' &nbsp; &nbsp; <div class="floatright">'.$langs->trans("EvenUnsubscribe").' ';
print ajax_object_onoff($object, 'evenunsubscribe', 'evenunsubscribe', 'EvenUnsubscribe:switch_on:warning', 'EvenUnsubscribe', array(), 'small valignmiddle', '', 1);
print '</div>';
print '</div>';
print '<div class="tagtd">&nbsp;</div>';
print '</div>'; // End tr
@ -386,8 +444,9 @@ if ($object->fetch($id) >= 0) {
$var = !$var;
if ($allowaddtarget) {
print '<form '.$bctag[$var].' name="'.$modulename.'" action="'.$_SERVER['PHP_SELF'].'?action=add&token='.newToken().'&id='.$object->id.'&module='.$modulename.'" method="POST" enctype="multipart/form-data">';
print '<form '.$bctag[$var].' name="'.$modulename.'" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&module='.$modulename.'" method="POST" enctype="multipart/form-data">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="add">';
print '<input type="hidden" name="page_y" value="'.newToken().'">';
} else {
print '<div '.$bctag[$var].'>';
@ -404,6 +463,8 @@ if ($object->fetch($id) >= 0) {
print '</div>';
try {
$obj->evenunsubscribe = $object->evenunsubscribe; // Set flag to include/exclude email that has opt-out.
$nbofrecipient = $obj->getNbOfRecipients('');
} catch (Exception $e) {
dol_syslog($e->getMessage(), LOG_ERR);
@ -470,8 +531,10 @@ if ($object->fetch($id) >= 0) {
// List of selected targets
$sql = "SELECT mc.rowid, mc.lastname, mc.firstname, mc.email, mc.other, mc.statut, mc.date_envoi, mc.tms,";
$sql .= " mc.source_url, mc.source_id, mc.source_type, mc.error_text";
$sql .= " mc.source_url, mc.source_id, mc.source_type, mc.error_text,";
$sql .= " COUNT(mu.rowid) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."mailing_unsubscribe as mu ON mu.email = mc.email";
$sql .= " WHERE mc.fk_mailing=".((int) $object->id);
$asearchcriteriahasbeenset = 0;
if ($search_lastname) {
@ -494,8 +557,10 @@ if ($object->fetch($id) >= 0) {
$sql .= " AND mc.statut = ".((int) $search_dest_status);
$asearchcriteriahasbeenset++;
}
$sql .= ' GROUP BY mc.rowid, mc.lastname, mc.firstname, mc.email, mc.other, mc.statut, mc.date_envoi, mc.tms, mc.source_url, mc.source_id, mc.source_type, mc.error_text';
$sql .= $db->order($sortfield, $sortorder);
// Count total nb of records
$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
@ -529,7 +594,7 @@ if ($object->fetch($id) >= 0) {
$param = "&id=".$object->id;
//if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
$param .= '&limit='.((int) $limit);
}
if ($search_lastname) {
$param .= "&search_lastname=".urlencode($search_lastname);
@ -578,6 +643,14 @@ if ($object->fetch($id) >= 0) {
// Ligne des champs de filtres
print '<tr class="liste_titre_filter">';
// Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="liste_titre maxwidthsearch">';
$searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0, 'checkforselect', 1);
print $searchpicto;
print '</td>';
}
// EMail
print '<td class="liste_titre">';
print '<input class="flat maxwidth75" type="text" name="search_email" value="'.dol_escape_htmltag($search_email).'">';
@ -614,10 +687,13 @@ if ($object->fetch($id) >= 0) {
print $formmailing->selectDestinariesStatus($search_dest_status, 'search_dest_status', 1);
print '</td>';
// Action column
print '<td class="liste_titre maxwidthsearch">';
$searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0, 'checkforselect', 1);
print $searchpicto;
print '</td>';
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="liste_titre maxwidthsearch">';
$searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0, 'checkforselect', 1);
print $searchpicto;
print '</td>';
}
print '</tr>';
if ($page) {
@ -625,6 +701,10 @@ if ($object->fetch($id) >= 0) {
}
print '<tr class="liste_titre">';
// Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch ');
}
print_liste_field_titre("EMail", $_SERVER["PHP_SELF"], "mc.email", $param, "", "", $sortfield, $sortorder);
print_liste_field_titre("Lastname", $_SERVER["PHP_SELF"], "mc.lastname", $param, "", "", $sortfield, $sortorder);
print_liste_field_titre("Firstname", $_SERVER["PHP_SELF"], "mc.firstname", $param, "", "", $sortfield, $sortorder);
@ -635,7 +715,10 @@ if ($object->fetch($id) >= 0) {
// Date sending
print_liste_field_titre("DateSending", $_SERVER["PHP_SELF"], "mc.date_envoi", $param, '', 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "mc.statut", $param, '', 'class="right"', $sortfield, $sortorder);
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch ');
// Action column
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch ');
}
print '</tr>';
$i = 0;
@ -656,10 +739,37 @@ if ($object->fetch($id) >= 0) {
$obj = $db->fetch_object($resql);
print '<tr class="oddeven">';
print '<td class="tdoverflowmax150">'.img_picto('$obj->email', 'email', 'class="paddingright"').dol_escape_htmltag($obj->email).'</td>';
// Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="center">';
print '<!-- ID mailing_cibles = '.$obj->rowid.' -->';
if ($obj->statut == $object::STATUS_DRAFT) { // Not sent yet
if (!empty($user->rights->mailing->creer)) {
print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=delete&token='.newToken().'&rowid='.((int) $obj->rowid).$param.'">'.img_delete($langs->trans("RemoveRecipient")).'</a>';
}
}
/*if ($obj->statut == -1) // Sent with error
{
print '<a href="'.$_SERVER['PHP_SELF'].'?action=retry&rowid='.$obj->rowid.$param.'">'.$langs->trans("Retry").'</a>';
}*/
print '</td>';
}
print '<td class="tdoverflowmax150">';
print img_picto($obj->email, 'email', 'class="paddingright"');
if ($obj->nb > 0) {
print img_warning($langs->trans("EmailOptedOut"), 'warning', 'pictofixedwidth');
}
print dol_escape_htmltag($obj->email);
print '</td>';
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->lastname).'">'.dol_escape_htmltag($obj->lastname).'</td>';
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->firstname).'">'.dol_escape_htmltag($obj->firstname).'</td>';
print '<td><span class="small">'.dol_escape_htmltag($obj->other).'</small></td>';
print '<td class="center tdoverflowmax150">';
if (empty($obj->source_id) || empty($obj->source_type)) {
print empty($obj->source_url) ? '' : $obj->source_url; // For backward compatibility
@ -691,7 +801,7 @@ if ($object->fetch($id) >= 0) {
print '</td>';
// Status of recipient sending email (Warning != status of emailing)
if ($obj->statut == 0) {
if ($obj->statut == $object::STATUS_DRAFT) {
// Date sent
print '<td align="center"></td>';
@ -707,19 +817,21 @@ if ($object->fetch($id) >= 0) {
print '</td>';
}
// Search Icon
print '<td class="right">';
print '<!-- ID mailing_cibles = '.$obj->rowid.' -->';
if ($obj->statut == 0) { // Not sent yet
if (!empty($user->rights->mailing->creer) && $allowaddtarget) {
print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=delete&token='.newToken().'&rowid='.$obj->rowid.$param.'">'.img_delete($langs->trans("RemoveRecipient")).'</a>';
// Action column
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="center">';
print '<!-- ID mailing_cibles = '.$obj->rowid.' -->';
if ($obj->statut == $object::STATUS_DRAFT) { // Not sent yet
if (!empty($user->rights->mailing->creer)) {
print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=delete&token='.newToken().'&rowid='.((int) $obj->rowid).$param.'">'.img_delete($langs->trans("RemoveRecipient")).'</a>';
}
}
/*if ($obj->statut == -1) // Sent with error
{
print '<a href="'.$_SERVER['PHP_SELF'].'?action=retry&rowid='.$obj->rowid.$param.'">'.$langs->trans("Retry").'</a>';
}*/
print '</td>';
}
/*if ($obj->statut == -1) // Sent with error
{
print '<a href="'.$_SERVER['PHP_SELF'].'?action=retry&rowid='.$obj->rowid.$param.'">'.$langs->trans("Retry").'</a>';
}*/
print '</td>';
print '</tr>';
$i++;

View File

@ -61,6 +61,11 @@ class Mailing extends CommonObject
*/
public $body;
/**
* @var int 1=Email will be sent even to email that has opt-out
*/
public $evenunsubscribe;
/**
* @var int number of email
*/
@ -317,6 +322,7 @@ class Mailing extends CommonObject
$sql .= ", email_errorsto = '".$this->db->escape($this->email_errorsto)."'";
$sql .= ", bgcolor = '".($this->bgcolor ? $this->db->escape($this->bgcolor) : null)."'";
$sql .= ", bgimage = '".($this->bgimage ? $this->db->escape($this->bgimage) : null)."'";
$sql .= ", evenunsubscribe = ".((int) $this->evenunsubscribe);
$sql .= " WHERE rowid = ".(int) $this->id;
dol_syslog(__METHOD__, LOG_DEBUG);
@ -351,13 +357,14 @@ class Mailing extends CommonObject
* Get object from database
*
* @param int $rowid Id of emailing
* @param string $ref Title to search from title
* @return int <0 if KO, >0 if OK
*/
public function fetch($rowid)
public function fetch($rowid, $ref = '')
{
global $conf;
$sql = "SELECT m.rowid, m.titre as title, m.sujet, m.body, m.bgcolor, m.bgimage";
$sql = "SELECT m.rowid, m.titre as title, m.sujet, m.body, m.bgcolor, m.bgimage, m.evenunsubscribe";
$sql .= ", m.email_from, m.email_replyto, m.email_errorsto";
$sql .= ", m.statut, m.nbemail";
$sql .= ", m.fk_user_creat, m.fk_user_valid";
@ -366,7 +373,12 @@ class Mailing extends CommonObject
$sql .= ", m.date_envoi";
$sql .= ", m.extraparams";
$sql .= " FROM ".MAIN_DB_PREFIX."mailing as m";
$sql .= " WHERE m.rowid = ".(int) $rowid;
$sql .= " WHERE entity IN (".getEntity('mailing').")";
if ($ref) {
$sql .= " AND m.titre = '".$this->db->escape($ref)."'";
} else {
$sql .= " AND m.rowid = ".(int) $rowid;
}
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
$result = $this->db->query($sql);
@ -389,6 +401,7 @@ class Mailing extends CommonObject
$this->bgcolor = $obj->bgcolor;
$this->bgimage = $obj->bgimage;
$this->evenunsubscribe = $obj->evenunsubscribe;
$this->email_from = $obj->email_from;
$this->email_replyto = $obj->email_replyto;
@ -454,6 +467,7 @@ class Mailing extends CommonObject
$object->body = '';
$object->bgcolor = '';
$object->bgimage = '';
$object->evenunsubscribe = 0;
//$object->email_from = ''; // We do not reset from email because it is a mandatory value
$object->email_replyto = '';
@ -891,7 +905,7 @@ class Mailing extends CommonObject
/**
* Return the label of a given status of a recipient
* Return the label of a given status of a recipient
* TODO Add class mailin_target.class.php
*
* @param int $status Id status

View File

@ -271,7 +271,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
$param .= '&limit='.((int) $limit);
}
if ($optioncss != '') {
$param .= '&optioncss='.urlencode($optioncss);

View File

@ -230,7 +230,7 @@ if ($object->id > 0) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
$param .= '&limit='.((int) $limit);
}
// Try to know count of actioncomm from cache

View File

@ -875,7 +875,7 @@ if ($resql) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
$param .= '&limit='.((int) $limit);
}
if ($sall) {
$param .= '&sall='.urlencode($sall);

View File

@ -230,7 +230,7 @@ if ($object->id > 0) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
$param .= '&limit='.((int) $limit);
}
// Try to know count of actioncomm from cache

View File

@ -587,7 +587,7 @@ if (empty($reshook)) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
$param .= '&limit='.((int) $limit);
}
if ($sall) {
$param .= '&sall='.urlencode($sall);
@ -1143,7 +1143,7 @@ if ($resql) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
$param .= '&limit='.((int) $limit);
}
if ($sall) {
$param .= '&sall='.urlencode($sall);

View File

@ -671,7 +671,7 @@ if ($resql) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
$param .= '&limit='.((int) $limit);
}
if ($sall) {
$param .= '&sall='.urlencode($sall);

View File

@ -286,7 +286,7 @@ if ((GETPOST('confirm_savestatement', 'alpha') || GETPOST('confirm_reconcile', '
$param .= '&offset='.urlencode($offset);
}
if ($limit) {
$param .= '&limit='.urlencode($limit);
$param .= '&limit='.((int) $limit);
}
if ($search_conciliated != '' && $search_conciliated != '-1') {
$param .= '&search_conciliated='.urlencode($search_conciliated);
@ -438,7 +438,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
$param .= '&limit='.((int) $limit);
}
if ($id > 0) {
$param .= '&id='.urlencode($id);

View File

@ -2589,10 +2589,10 @@ class AccountLine extends CommonObjectLine
/**
* Return label of status (activity, closed)
* Return the label of the status
*
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long
* @return string Libelle
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function getLibStatut($mode = 0)
{
@ -2601,11 +2601,11 @@ class AccountLine extends CommonObjectLine
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoi le libelle d'un statut donne
* Return the label of a given status
*
* @param int $status Id statut
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Libelle du statut
* @param int $status Id status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function LibStatut($status, $mode = 0)
{

View File

@ -603,10 +603,10 @@ class PaymentVarious extends CommonObject
/**
* Retourne le libelle du statut
* Return the label of the status
*
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
* @return string Libelle
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function getLibStatut($mode = 0)
{
@ -615,11 +615,11 @@ class PaymentVarious extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoi le libelle d'un statut donne
* Return the label of a given status
*
* @param int $status Id status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
* @return string Libelle
* @param int $status Id status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function LibStatut($status, $mode = 0)
{

View File

@ -313,7 +313,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
$param .= '&limit='.((int) $limit);
}
if ($search_ref != '') {
$param .= '&search_ref='.urlencode($search_ref);

View File

@ -351,7 +351,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
$param .= '&limit='.((int) $limit);
}
if ($search_ref) {
$param .= '&search_ref='.urlencode($search_ref);

View File

@ -348,7 +348,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
$param .= '&limit='.((int) $limit);
}
foreach ($search as $key => $val) {
if (is_array($search[$key])) {

View File

@ -338,10 +338,10 @@ class Deplacement extends CommonObject
/**
* Retourne le libelle du statut
* Return the label of the status
*
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
* @return string Libelle
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function getLibStatut($mode = 0)
{
@ -350,11 +350,11 @@ class Deplacement extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoi le libelle d'un statut donne
* Return the label of a given status
*
* @param int $status Id status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
* @return string Libelle
* @param int $status Id status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function LibStatut($status, $mode = 0)
{

View File

@ -230,7 +230,7 @@ if ($object->id > 0) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
$param .= '&limit='.((int) $limit);
}
// Try to know count of actioncomm from cache

View File

@ -3908,7 +3908,7 @@ if ($action == 'create') {
print $objectsrc->getNomUrl(1);
// We check if Origin document (id and type is known) has already at least one invoice attached to it
$objectsrc->fetchObjectLinked($originid, $origin, '', 'facture');
if (is_array($objectsrc->linkedObjects['facture']) && count($objectsrc->linkedObjects['facture']) >= 1) {
if (isset($objectsrc->linkedObjects['facture']) && is_array($objectsrc->linkedObjects['facture']) && count($objectsrc->linkedObjects['facture']) >= 1) {
setEventMessages('WarningBillExist', null, 'warnings');
echo ' - '.$langs->trans('LatestRelatedBill').' '.end($objectsrc->linkedObjects['facture'])->getNomUrl(1);
}

View File

@ -3393,7 +3393,6 @@ class Facture extends CommonInvoice
// Set new ref and define current status
if (!$error) {
$this->ref = $num;
$this->ref = $num;
$this->statut = self::STATUS_VALIDATED;
$this->status = self::STATUS_VALIDATED;
@ -6441,7 +6440,7 @@ class FactureLigne extends CommonInvoiceLine
return -1;
}
$sql = 'UPDATE '.MAIN_DB_PREFIX.'projet_task_time';
$sql = 'UPDATE '.MAIN_DB_PREFIX.'element_time';
$sql .= ' SET invoice_id = NULL, invoice_line_id = NULL';
$sql .= ' WHERE invoice_line_id = '.((int) $this->id);
if (!$this->db->query($sql)) {

View File

@ -440,7 +440,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
$param .= '&limit='.((int) $limit);
}
if ($socid > 0) {
$param .= '&socid='.urlencode($socid);

View File

@ -993,7 +993,7 @@ if ($resql) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
$param .= '&limit='.((int) $limit);
}
if ($sall) {
$param .= '&sall='.urlencode($sall);
@ -2590,6 +2590,9 @@ if ($resql) {
$i++;
}
// Use correct digits number for totals
$totalarray['val']['total_margin'] = price2num($totalarray['val']['total_margin'], 'MT');
// Show total line
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
}

View File

@ -604,10 +604,10 @@ class Localtax extends CommonObject
}
/**
* Retourne le libelle du statut d'une facture (brouillon, validee, abandonnee, payee)
* Return the label of the status
*
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Libelle
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function getLibStatut($mode = 0)
{
@ -616,16 +616,16 @@ class Localtax extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoi le libelle d'un statut donne
* Return the label of a given status
*
* @param int $status Statut
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Libelle du statut
* @param int $status Id status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function LibStatut($status, $mode = 0)
{
// phpcs:enable
global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage
//global $langs;
return '';
}

View File

@ -995,10 +995,10 @@ class RemiseCheque extends CommonObject
}
/**
* Retourne le libelle du statut d'une facture (brouillon, validee, abandonnee, payee)
* Return the label of the status
*
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Libelle
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function getLibStatut($mode = 0)
{
@ -1007,11 +1007,11 @@ class RemiseCheque extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return label of a status
* Return the label of a given status
*
* @param int $status Id status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=Long label + picto
* @return string Libelle du statut
* @param int $status Id status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function LibStatut($status, $mode = 0)
{

View File

@ -1303,10 +1303,10 @@ class Paiement extends CommonObject
}
/**
* Retourne le libelle du statut d'une facture (brouillon, validee, abandonnee, payee)
* Return the label of the status
*
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Libelle
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function getLibStatut($mode = 0)
{
@ -1315,11 +1315,11 @@ class Paiement extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoi le libelle d'un statut donne
* Return the label of a given status
*
* @param int $status Statut
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Libelle du statut
* @param int $status Id status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function LibStatut($status, $mode = 0)
{

View File

@ -301,7 +301,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
$param .= '&limit='.((int) $limit);
}
if (GETPOST("orphelins")) {

View File

@ -222,11 +222,8 @@ print dol_get_fiche_end();
$disable_delete = 0;
$sql = 'SELECT f.rowid as scid, f.label as label, f.paye, f.amount as tva_amount, pf.amount';
//$sql .= ', pc.libelle as sc_type';
$sql .= ' FROM '.MAIN_DB_PREFIX.'payment_vat as pf,'.MAIN_DB_PREFIX.'tva as f';
//$sql .= ', '.MAIN_DB_PREFIX.'c_chargesociales as pc';
$sql .= ' WHERE pf.fk_tva = f.rowid';
//$sql .= ' AND f.fk_type = pc.id';
$sql .= ' AND f.entity = '.$conf->entity;
$sql .= ' AND pf.rowid = '.((int) $object->id);

View File

@ -412,7 +412,7 @@ if ($id > 0 || $ref) {
$urladd = "&id=".urlencode($id);
if ($limit > 0 && $limit != $conf->liste_limit) {
$urladd .= '&limit='.urlencode($limit);
$urladd .= '&limit='.((int) $limit);
}
print '<form method="POST" action="'.$_SERVER ['PHP_SELF'].'" name="search_form">'."\n";

View File

@ -1888,7 +1888,7 @@ class BonPrelevement extends CommonObject
fputs($this->file, substr("000000000000000".$montant, -16));
// Libelle F
// Label F
fputs($this->file, substr("*_".$ref."_RDVnet".$rowid." ", 0, 31));

View File

@ -395,7 +395,7 @@ if ($resql) {
$param = '';
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
$param .= '&limit='.((int) $limit);
}
if ($socid) {
$param .= '&socid='.urlencode($socid);

View File

@ -235,7 +235,7 @@ if ($resql) {
$i = 0;
if ($limit > 0 && $limit != $conf->liste_limit) {
$param.='&limit='.urlencode($limit);
$param.='&limit='.((int) $limit);
}
$param = "&id=".urlencode($id);

View File

@ -196,7 +196,7 @@ if ($result) {
$param .= '&amp;type=bank-transfer';
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
$param .= '&limit='.((int) $limit);
}
$newcardbutton = '';
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition'));

View File

@ -159,7 +159,7 @@ if ($result) {
$param .= '&amp;type=bank-transfer';
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
$param .= '&limit='.((int) $limit);
}
$param .= "&statut=".urlencode($statut);

View File

@ -441,9 +441,9 @@ class Cchargesociales
}
/**
* Retourne le libelle du status d'un user (actif, inactif)
* Return the label of the status
*
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function getLibStatut($mode = 0)
@ -453,11 +453,11 @@ class Cchargesociales
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoi le libelle d'un status donne
* Return the label of a given status
*
* @param int $status Id status
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Label of status
* @param int $status Id status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function LibStatut($status, $mode = 0)
{

View File

@ -664,10 +664,10 @@ class PaymentSocialContribution extends CommonObject
/**
* Retourne le libelle du statut d'une facture (brouillon, validee, abandonnee, payee)
* Return the label of the status
*
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Libelle
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function getLibStatut($mode = 0)
{
@ -676,11 +676,11 @@ class PaymentSocialContribution extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoi le libelle d'un statut donne
* Return the label of a given status
*
* @param int $status Statut
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Libelle du statut
* @param int $status Id status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function LibStatut($status, $mode = 0)
{

View File

@ -314,7 +314,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
$param .= '&limit='.((int) $limit);
}
if ($search_ref) {
$param .= '&search_ref='.urlencode($search_ref);

View File

@ -114,7 +114,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
$param .= '&limit='.((int) $limit);
}
if ($sortfield) {
$param .= '&sortfield='.urlencode($sortfield);

View File

@ -663,16 +663,16 @@ class PaymentVAT extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoi le libelle d'un statut donne
* Return the label of a given status
*
* @param int $status Statut
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Libelle du statut
* @param int $status Id status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function LibStatut($status, $mode = 0)
{
// phpcs:enable
global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage
global $langs;
$langs->load('compta');
/*if ($mode == 0)

View File

@ -849,7 +849,7 @@ class Tva extends CommonObject
}
/**
* Retourne le libelle du statut d'une TVA (impaye, payee)
* Return the label of the VAT status f object
*
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=Long label + picto
* @param double $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise)
@ -862,7 +862,7 @@ class Tva extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoi le libelle d'un statut donne
* Return the label of a given VAT status
*
* @param int $status Id status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=Long label + picto

View File

@ -1580,10 +1580,10 @@ class Contact extends CommonObject
}
/**
* Return label of contact status
* Return the label of the status
*
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Label of contact status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function getLibStatut($mode)
{
@ -1592,11 +1592,11 @@ class Contact extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoi le libelle d'un statut donne
* Return the label of a given status
*
* @param int $status Id statut
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Libelle
* @param int $status Id status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function LibStatut($status, $mode)
{
@ -2009,9 +2009,9 @@ class Contact extends CommonObject
/**
* Return status of prospect
*
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long
* @param int $mode 0=label long, 1=label short, 2=Picto + Label short, 3=Picto, 4=Picto + Label long
* @param string $label Label to use for status for added status
* @return string Libelle
* @return string Label
*/
public function getLibProspCommStatut($mode = 0, $label = '')
{
@ -2029,7 +2029,7 @@ class Contact extends CommonObject
* Example: picto.png if picto.png is stored into htdocs/theme/mytheme/img
* Example: picto.png@mymodule if picto.png is stored into htdocs/mymodule/img
* Example: /mydir/mysubdir/picto.png if picto.png is stored into htdocs/mydir/mysubdir (pictoisfullpath must be set to 1)
* @return string Libelle du statut
* @return string Label of status
*/
public function libProspCommStatut($statut, $mode = 0, $label = '', $picto = '')
{

View File

@ -382,7 +382,7 @@ if ($sql_select) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
$param .= '&limit='.((int) $limit);
}
if ($sprod_fulldescr) {
$param .= "&sprod_fulldescr=".urlencode($sprod_fulldescr);

View File

@ -746,12 +746,22 @@ if (empty($reshook)) {
$fk_unit = GETPOST('unit', 'alpha');
// update price_ht with discount
// TODO Use object->updateline instead objedtline->update
$price_ht = price2num(GETPOST('elprice'), 'MU');
$remise_percent = price2num(GETPOST('elremise_percent'), 2);
if ($remise_percent > 0) {
$remise = round(($price_ht * $remise_percent / 100), 2);
$price_ht = ($price_ht - $remise);
}
$objectline->fk_product = GETPOST('idprod', 'int');
$objectline->description = GETPOST('product_desc', 'restricthtml');
$objectline->price_ht = price2num(GETPOST('elprice'), 'MU');
$objectline->price_ht = $price_ht;
$objectline->subprice = price2num(GETPOST('elprice'), 'MU');
$objectline->qty = price2num(GETPOST('elqty'), 'MS');
$objectline->remise_percent = price2num(GETPOST('elremise_percent'), 2);
$objectline->remise_percent = $remise_percent;
$objectline->tva_tx = ($txtva ? $txtva : 0); // Field may be disabled, so we use vat rate 0
$objectline->vat_src_code = $vat_src_code;
$objectline->localtax1_tx = is_numeric($localtax1_tx) ? $localtax1_tx : 0;

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