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

This commit is contained in:
Florian HENRY 2021-02-04 09:06:36 +01:00
commit 2d77787bba
962 changed files with 5711 additions and 2691 deletions

View File

@ -3,6 +3,24 @@ English Dolibarr ChangeLog
-------------------------------------------------------------- --------------------------------------------------------------
***** ChangeLog for 14.0.0 compared to 13.0.0 *****
For users:
----------
For developers:
---------------
WARNING:
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
* The ICS value for direct debit or credit transfer is now store on each bank account instead of into the global setup.
***** ChangeLog for 13.0.0 compared to 12.0.0 ***** ***** ChangeLog for 13.0.0 compared to 12.0.0 *****
For users: For users:
@ -181,8 +199,7 @@ NEW: add option "If the feature to manage kits of module Stock is used, show det
For developers: For developers:
--------------- ---------------
NEW: add substitution key __MEMBER_TYPE__ NEW: add __MEMBER_TYPE__ and __TYPE__ substitution key
NEW: add substitution key __TYPE__
NEW: add function dolButtonToOpenUrlInDialogPopup() to be able to open page into a popup NEW: add function dolButtonToOpenUrlInDialogPopup() to be able to open page into a popup
NEW: show line number on intervention card (via MAIN_VIEW_LINE_NUMBER) NEW: show line number on intervention card (via MAIN_VIEW_LINE_NUMBER)
NEW: add some fields to link website page to an other object NEW: add some fields to link website page to an other object
@ -194,12 +211,9 @@ NEW: can add event to log into blockedlog module with a constant
NEW: add property cssview when declaring fields of an object NEW: add property cssview when declaring fields of an object
NEW: can use dynamic code into the 'enabled' property of DAO fields NEW: can use dynamic code into the 'enabled' property of DAO fields
NEW: field ref_ext in llx_commandedet NEW: field ref_ext in llx_commandedet
NEW: field ref_ext for Attributes and Combinations NEW: fields ref_ext for Attributes and Combinations
NEW: OAuth SCOPE for Admin SDK NEW: OAuth SCOPE for Admin SDK
NEW: retrieve discount from invoice from API
NEW: standardizes API thirdparties by email like other object NEW: standardizes API thirdparties by email like other object
NEW: Thirdparty REST API: endpoint to set price level
NEW: use new category API for project list view
NEW: Triggers Attributes and Attributes values NEW: Triggers Attributes and Attributes values
NEW: add incoterms data into the substitution array NEW: add incoterms data into the substitution array
NEW: add send context for ticket NEW: add send context for ticket
@ -216,11 +230,12 @@ NEW: API can update a payment
NEW: API get member by thirdparty NEW: API get member by thirdparty
NEW: API get thirdparty by barcode NEW: API get thirdparty by barcode
NEW: API get users by email / login NEW: API get users by email / login
NEW: allow to edit field "demand reason" through API
NEW: fetch contact by email with REST API NEW: fetch contact by email with REST API
NEW: get state by REST API NEW: get state dictionnary by REST API
NEW: get state dictionary by REST API NEW: improve Product API for variant products
NEW: improve Product API for product variants NEW: retrieve discount from invoice from API
NEW: Thirdparty REST API: endpoint to set price level
NEW: use new category API for project list view
HOOKs HOOKs
NEW: add hook on propal card NEW: add hook on propal card
@ -238,7 +253,7 @@ Following changes may create regressions for some external modules, but were nec
* All properties ->titre have been renamed into ->title * All properties ->titre have been renamed into ->title
* Property $paiementid in API 'api_supplier_invoices.php' has been renamed into into $payment_mode_id * Property $paiementid in API 'api_supplier_invoices.php' has been renamed into into $payment_mode_id
* Property 'num_paiement' has been renamed 'num_payment' everywhere for better code consistency. * Property 'num_paiement' has been renamed 'num_payment' everywhere for better code consistency.
* The deprecated subsitution key __SIGNATURE__ has been removed. Use __USER_SIGNATURE__ if you used the old syntax in your email templates. * The deprecated subsitution key __SIGNATURE__ has been removed. Replace it with __USER_SIGNATURE__ if you used the old syntax in your email templates.
* The hidden option HOLIDAY_MORE_PUBLIC_HOLIDAYS has been removed. Use instead the dictionary table if you need to define custom days of holiday. * The hidden option HOLIDAY_MORE_PUBLIC_HOLIDAYS has been removed. Use instead the dictionary table if you need to define custom days of holiday.
* If you build a class that implement CommonObject to use the incoterm properties or methods (->fk_incoterm, ->label_incoterm, ->location_incoterm), * If you build a class that implement CommonObject to use the incoterm properties or methods (->fk_incoterm, ->label_incoterm, ->location_incoterm),
you must now also include declaration of the Trait 'CommonIncoterm' in your class. All incoterm functions were moved into this Trait. you must now also include declaration of the Trait 'CommonIncoterm' in your class. All incoterm functions were moved into this Trait.
@ -250,8 +265,9 @@ Following changes may create regressions for some external modules, but were nec
* Function showStripePaymentUrl, getStripePaymentUrl, showPaypalPaymentUrl and getPaypalPaymentUrl has been removed. The generic one showOnlinePaymentUrl and getOnlinePaymentUrl are always used. * Function showStripePaymentUrl, getStripePaymentUrl, showPaypalPaymentUrl and getPaypalPaymentUrl has been removed. The generic one showOnlinePaymentUrl and getOnlinePaymentUrl are always used.
* Context for hook showSocinfoOnPrint has been moved from "showsocinfoonprint" to "main" * Context for hook showSocinfoOnPrint has been moved from "showsocinfoonprint" to "main"
* Library htdocs/includes/phpoffice/phpexcel as been removed (replaced with htdocs/includes/phpoffice/PhpSpreadsheet) * Library htdocs/includes/phpoffice/phpexcel as been removed (replaced with htdocs/includes/phpoffice/PhpSpreadsheet)
* Databse transaction in your triggers must be correctly balanced (one close for one open). If not, an error will be returned by the trigger, even if trigger did return error code. * Database transaction in your triggers must be correctly balanced (one close for one open). If not, an error will be returned by the trigger, even if trigger did return error code.
* Dolibarr v13 is still compatible with any PHP version between 5.6.0 and 7.4.*; Unit tests are OK with PHP 8.0 but some warnings or troubles may appears with PHP 8.0.
* All your Ajax services must contains such a line at begin of file: if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Disables token renewal
***** ChangeLog for 12.0.4 compared to 12.0.3 ***** ***** ChangeLog for 12.0.4 compared to 12.0.3 *****
FIX: make formConfirm an addreplace-type hook FIX: make formConfirm an addreplace-type hook

View File

@ -4,7 +4,7 @@ Priority: optional
Maintainer: Laurent Destailleur (eldy) <eldy@users.sourceforge.net> Maintainer: Laurent Destailleur (eldy) <eldy@users.sourceforge.net>
# Uploaders: Laurent Destailleur (eldy) <eldy@users.sourceforge.net> # Only if differs from Maintainer # Uploaders: Laurent Destailleur (eldy) <eldy@users.sourceforge.net> # Only if differs from Maintainer
Standards-Version: 3.9.6 Standards-Version: 3.9.6
Homepage: http://www.dolibarr.org Homepage: https://www.dolibarr.org
Build-Depends: debhelper (>= 9), po-debconf Build-Depends: debhelper (>= 9), po-debconf
# This package need at least debian 7 or ubuntu 13.04 or any distribution based on this version # This package need at least debian 7 or ubuntu 13.04 or any distribution based on this version

View File

@ -23,7 +23,7 @@ setup_empty_conf() {
mkdir -p /etc/dolibarr mkdir -p /etc/dolibarr
touch /etc/dolibarr/conf.php touch /etc/dolibarr/conf.php
chown root:www-data /etc/dolibarr/conf.php chown root:www-data /etc/dolibarr/conf.php
chmod 664 /etc/dolibarr/conf.php chmod 660 /etc/dolibarr/conf.php
} }
is_new_upstream_version() { is_new_upstream_version() {

View File

@ -105,8 +105,8 @@ if (empty($includecustom)) {
} }
} }
print "Release : ".$release."\n";
print "Working on files into : ".DOL_DOCUMENT_ROOT."\n"; print "Working on files into : ".DOL_DOCUMENT_ROOT."\n";
print "Release : ".$release."\n";
print "Include custom in signature : ".$includecustom."\n"; print "Include custom in signature : ".$includecustom."\n";
print "Include constants in signature : "; print "Include constants in signature : ";
foreach ($includeconstants as $countrycode => $tmp) { foreach ($includeconstants as $countrycode => $tmp) {

View File

@ -444,9 +444,6 @@ if ($id)
// Form to add a new line // Form to add a new line
if ($tabname[$id]) if ($tabname[$id])
{ {
$alabelisused = 0;
$var = false;
$fieldlist = explode(',', $tabfield[$id]); $fieldlist = explode(',', $tabfield[$id]);
// Line for title // Line for title
@ -481,7 +478,6 @@ if ($id)
} }
print '</td>'; print '</td>';
} }
if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') $alabelisused = 1;
} }
print '<td>'; print '<td>';
@ -612,7 +608,7 @@ if ($id)
print '&nbsp;<input type="submit" class="button button-cancel" name="actioncancel" value="'.$langs->trans("Cancel").'"></td>'; print '&nbsp;<input type="submit" class="button button-cancel" name="actioncancel" value="'.$langs->trans("Cancel").'"></td>';
} else { } else {
$tmpaction = 'view'; $tmpaction = 'view';
$parameters = array('var'=>$var, 'fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); $parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
$reshook = $hookmanager->executeHooks('viewDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('viewDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
$error = $hookmanager->error; $errors = $hookmanager->errors; $error = $hookmanager->error; $errors = $hookmanager->errors;

View File

@ -76,7 +76,7 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount)
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Label")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Label")), null, 'errors');
$action = 'create'; $action = 'create';
} else { } else {
$sql = 'SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $conf->global->CHARTOFACCOUNTS; $sql = 'SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid='.((int) $conf->global->CHARTOFACCOUNTS);
dol_syslog('accountancy/admin/card.php:: $sql=' . $sql); dol_syslog('accountancy/admin/card.php:: $sql=' . $sql);
$result = $db->query($sql); $result = $db->query($sql);

View File

@ -438,8 +438,6 @@ if ($id)
// Form to add a new line // Form to add a new line
if ($tabname[$id]) if ($tabname[$id])
{ {
$alabelisused = 0;
$fieldlist = explode(',', $tabfield[$id]); $fieldlist = explode(',', $tabfield[$id]);
// Line for title // Line for title
@ -496,7 +494,6 @@ if ($id)
else print $valuetoshow; else print $valuetoshow;
print '</td>'; print '</td>';
} }
if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') $alabelisused = 1;
} }
print '<td>'; print '<td>';

View File

@ -100,7 +100,7 @@ if ($action == 'update') {
if ($action == 'setlistsorttodo') { if ($action == 'setlistsorttodo') {
$setlistsorttodo = GETPOST('value', 'int'); $setlistsorttodo = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "ACCOUNTING_LIST_SORT_VENTILATION_TODO", $setlistsorttodo, 'yesno', 0, '', $conf->entity); $res = dolibarr_set_const($db, "ACCOUNTING_LIST_SORT_VENTILATION_TODO", $setlistsorttodo, 'yesno', 0, '', $conf->entity);
if (!$res > 0) { if (!($res > 0)) {
$error++; $error++;
} }
@ -114,9 +114,10 @@ if ($action == 'setlistsorttodo') {
if ($action == 'setlistsortdone') { if ($action == 'setlistsortdone') {
$setlistsortdone = GETPOST('value', 'int'); $setlistsortdone = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "ACCOUNTING_LIST_SORT_VENTILATION_DONE", $setlistsortdone, 'yesno', 0, '', $conf->entity); $res = dolibarr_set_const($db, "ACCOUNTING_LIST_SORT_VENTILATION_DONE", $setlistsortdone, 'yesno', 0, '', $conf->entity);
if (!$res > 0) { if (!($res > 0)) {
$error++; $error++;
} }
if (!$error) { if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else { } else {
@ -127,9 +128,10 @@ if ($action == 'setlistsortdone') {
if ($action == 'setmanagezero') { if ($action == 'setmanagezero') {
$setmanagezero = GETPOST('value', 'int'); $setmanagezero = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "ACCOUNTING_MANAGE_ZERO", $setmanagezero, 'yesno', 0, '', $conf->entity); $res = dolibarr_set_const($db, "ACCOUNTING_MANAGE_ZERO", $setmanagezero, 'yesno', 0, '', $conf->entity);
if (!$res > 0) { if (!($res > 0)) {
$error++; $error++;
} }
if (!$error) { if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else { } else {
@ -140,9 +142,10 @@ if ($action == 'setmanagezero') {
if ($action == 'setdisabledirectinput') { if ($action == 'setdisabledirectinput') {
$setdisabledirectinput = GETPOST('value', 'int'); $setdisabledirectinput = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "BANK_DISABLE_DIRECT_INPUT", $setdisabledirectinput, 'yesno', 0, '', $conf->entity); $res = dolibarr_set_const($db, "BANK_DISABLE_DIRECT_INPUT", $setdisabledirectinput, 'yesno', 0, '', $conf->entity);
if (!$res > 0) { if (!($res > 0)) {
$error++; $error++;
} }
if (!$error) { if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else { } else {
@ -153,9 +156,10 @@ if ($action == 'setdisabledirectinput') {
if ($action == 'setenabledraftexport') { if ($action == 'setenabledraftexport') {
$setenabledraftexport = GETPOST('value', 'int'); $setenabledraftexport = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL", $setenabledraftexport, 'yesno', 0, '', $conf->entity); $res = dolibarr_set_const($db, "ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL", $setenabledraftexport, 'yesno', 0, '', $conf->entity);
if (!$res > 0) { if (!($res > 0)) {
$error++; $error++;
} }
if (!$error) { if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else { } else {
@ -166,9 +170,10 @@ if ($action == 'setenabledraftexport') {
if ($action == 'setenablesubsidiarylist') { if ($action == 'setenablesubsidiarylist') {
$setenablesubsidiarylist = GETPOST('value', 'int'); $setenablesubsidiarylist = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "ACCOUNTANCY_COMBO_FOR_AUX", $setenablesubsidiarylist, 'yesno', 0, '', $conf->entity); $res = dolibarr_set_const($db, "ACCOUNTANCY_COMBO_FOR_AUX", $setenablesubsidiarylist, 'yesno', 0, '', $conf->entity);
if (!$res > 0) { if (!($res > 0)) {
$error++; $error++;
} }
if (!$error) { if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else { } else {
@ -179,9 +184,10 @@ if ($action == 'setenablesubsidiarylist') {
if ($action == 'setdisablebindingonsales') { if ($action == 'setdisablebindingonsales') {
$setdisablebindingonsales = GETPOST('value', 'int'); $setdisablebindingonsales = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "ACCOUNTING_DISABLE_BINDING_ON_SALES", $setdisablebindingonsales, 'yesno', 0, '', $conf->entity); $res = dolibarr_set_const($db, "ACCOUNTING_DISABLE_BINDING_ON_SALES", $setdisablebindingonsales, 'yesno', 0, '', $conf->entity);
if (!$res > 0) { if (!($res > 0)) {
$error++; $error++;
} }
if (!$error) { if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else { } else {
@ -192,9 +198,10 @@ if ($action == 'setdisablebindingonsales') {
if ($action == 'setdisablebindingonpurchases') { if ($action == 'setdisablebindingonpurchases') {
$setdisablebindingonpurchases = GETPOST('value', 'int'); $setdisablebindingonpurchases = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "ACCOUNTING_DISABLE_BINDING_ON_PURCHASES", $setdisablebindingonpurchases, 'yesno', 0, '', $conf->entity); $res = dolibarr_set_const($db, "ACCOUNTING_DISABLE_BINDING_ON_PURCHASES", $setdisablebindingonpurchases, 'yesno', 0, '', $conf->entity);
if (!$res > 0) { if (!($res > 0)) {
$error++; $error++;
} }
if (!$error) { if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else { } else {
@ -205,9 +212,10 @@ if ($action == 'setdisablebindingonpurchases') {
if ($action == 'setdisablebindingonexpensereports') { if ($action == 'setdisablebindingonexpensereports') {
$setdisablebindingonexpensereports = GETPOST('value', 'int'); $setdisablebindingonexpensereports = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS", $setdisablebindingonexpensereports, 'yesno', 0, '', $conf->entity); $res = dolibarr_set_const($db, "ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS", $setdisablebindingonexpensereports, 'yesno', 0, '', $conf->entity);
if (!$res > 0) { if (!($res > 0)) {
$error++; $error++;
} }
if (!$error) { if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else { } else {
@ -215,9 +223,11 @@ if ($action == 'setdisablebindingonexpensereports') {
} }
} }
/* /*
* View * View
*/ */
$form = new Form($db); $form = new Form($db);
$title = $langs->trans('ConfigAccountingExpert'); $title = $langs->trans('ConfigAccountingExpert');

View File

@ -407,8 +407,6 @@ if ($id)
// Form to add a new line // Form to add a new line
if ($tabname[$id]) if ($tabname[$id])
{ {
$alabelisused = 0;
$fieldlist = explode(',', $tabfield[$id]); $fieldlist = explode(',', $tabfield[$id]);
// Line for title // Line for title
@ -437,7 +435,6 @@ if ($id)
else print $valuetoshow; else print $valuetoshow;
print '</td>'; print '</td>';
} }
if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') $alabelisused = 1;
} }
print '<td>'; print '<td>';

View File

@ -16,7 +16,6 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/ */
/** /**
@ -307,7 +306,7 @@ if ($action != 'export_csv')
$accountingaccountstatic->fetch(null, $line->numero_compte, true); $accountingaccountstatic->fetch(null, $line->numero_compte, true);
if (!empty($accountingaccountstatic->account_number)) { if (!empty($accountingaccountstatic->account_number)) {
$accounting_account = $accountingaccountstatic->getNomUrl(0, 1); $accounting_account = $accountingaccountstatic->getNomUrl(0, 1, 0, '', 0, -1, 0, 'accountcard');
} else { } else {
$accounting_account = length_accountg($line->numero_compte); $accounting_account = length_accountg($line->numero_compte);
} }
@ -322,10 +321,19 @@ if ($action != 'export_csv')
$root_account_description = $tmparrayforrootaccount['label']; $root_account_description = $tmparrayforrootaccount['label'];
$root_account_number = $tmparrayforrootaccount['account_number']; $root_account_number = $tmparrayforrootaccount['account_number'];
//var_dump($tmparrayforrootaccount);
//var_dump($accounting_account);
//var_dump($accountingaccountstatic);
if (empty($accountingaccountstatic->label) && $accountingaccountstatic->id > 0) { if (empty($accountingaccountstatic->label) && $accountingaccountstatic->id > 0) {
$link = '<a class="editfielda reposition" href="' . DOL_URL_ROOT . '/accountancy/admin/card.php?action=update&token=' . newToken() . '&id=' . $accountingaccountstatic->id . '">' . img_edit() . '</a>'; $link = '<a class="editfielda reposition" href="' . DOL_URL_ROOT . '/accountancy/admin/card.php?action=update&token=' . newToken() . '&id=' . $accountingaccountstatic->id . '">' . img_edit() . '</a>';
} elseif (empty($tmparrayforrootaccount['label'])) { } elseif ($accounting_account == 'NotDefined') {
$link = '<a href="' . DOL_URL_ROOT . '/accountancy/admin/card.php?action=create&token=' . newToken() . '&accountingaccount=' . length_accountg($line->numero_compte) . '">' . img_edit_add() . '</a>'; $link = '<a href="' . DOL_URL_ROOT . '/accountancy/admin/card.php?action=create&token=' . newToken() . '&accountingaccount=' . length_accountg($line->numero_compte) . '">' . img_edit_add() . '</a>';
} elseif (empty($tmparrayforrootaccount['label'])) {
// $tmparrayforrootaccount['label'] not defined = the account has not parent with a parent.
// This is useless, we should not create a new account when an account has no parent, we must edit it to fix its parent.
// BUG 1: Accounts on level root or level 1 must not have a parent 2 level higher, so shoule not show a link to create another account.
// BUG 2: Adding a link to create a new accounting account here is useless because it is not add as parent of the orphelin.
//$link = '<a href="' . DOL_URL_ROOT . '/accountancy/admin/card.php?action=create&token=' . newToken() . '&accountingaccount=' . length_accountg($line->numero_compte) . '">' . img_edit_add() . '</a>';
} }
if (!empty($show_subgroup)) if (!empty($show_subgroup))
@ -363,8 +371,22 @@ if ($action != 'export_csv')
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.$accounting_account.'</td>'; print '<td>'.$accounting_account.'</td>';
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) print '<td class="nowraponall right">'.price($opening_balance).'</td>'; if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) print '<td class="nowraponall right">'.price($opening_balance).'</td>';
print '<td class="nowraponall right">'.price($line->debit).'</td>';
print '<td class="nowraponall right">'.price($line->credit).'</td>'; $urlzoom = '';
if ($line->numero_compte) {
$urlzoom = DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?search_accountancy_code_start='.urlencode($line->numero_compte).'&search_accountancy_code_end='.urlencode($line->numero_compte);
if (GETPOSTISSET('date_startmonth')) {
$urlzoom .= '&search_date_startmonth='.GETPOST('date_startmonth', 'int').'&search_date_startday='.GETPOST('date_startday', 'int').'&search_date_startyear='.GETPOST('date_startyear', 'int');
}
if (GETPOSTISSET('date_endmonth')) {
$urlzoom .= '&search_date_endmonth='.GETPOST('date_endmonth', 'int').'&search_date_endday='.GETPOST('date_endday', 'int').'&search_date_endyear='.GETPOST('date_endyear', 'int');
}
}
// Debit
print '<td class="nowraponall right"><a href="'.$urlzoom.'">'.price($line->debit).'</a></td>';
// Credit
print '<td class="nowraponall right"><a href="'.$urlzoom.'">'.price($line->credit).'</a></td>';
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) { if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) {
print '<td class="nowraponall right">'.price(price2num($opening_balance + $line->debit - $line->credit, 'MT')).'</td>'; print '<td class="nowraponall right">'.price(price2num($opening_balance + $line->debit - $line->credit, 'MT')).'</td>';
} else { } else {

View File

@ -63,9 +63,11 @@ $accountingjournal->fetch(null, $journal_code);
$journal_label = $accountingjournal->label; $journal_label = $accountingjournal->label;
$subledger_account = GETPOST('subledger_account', 'alphanohtml'); $subledger_account = GETPOST('subledger_account', 'alphanohtml');
if ($subledger_account == - 1) { if ($subledger_account == -1) {
$subledger_account = null; $subledger_account = null;
} }
$subledger_label = GETPOST('subledger_label', 'alphanohtml');
$label_operation = GETPOST('label_operation', 'alphanohtml'); $label_operation = GETPOST('label_operation', 'alphanohtml');
$debit = price2num(GETPOST('debit', 'alpha')); $debit = price2num(GETPOST('debit', 'alpha'));
$credit = price2num(GETPOST('credit', 'alpha')); $credit = price2num(GETPOST('credit', 'alpha'));
@ -108,6 +110,7 @@ if ($action == "confirm_update") {
} else { } else {
$object->numero_compte = $accountingaccount_number; $object->numero_compte = $accountingaccount_number;
$object->subledger_account = $subledger_account; $object->subledger_account = $subledger_account;
$object->subledger_label = $subledger_label;
$object->label_compte = $accountingaccount_label; $object->label_compte = $accountingaccount_label;
$object->label_operation = $label_operation; $object->label_operation = $label_operation;
$object->debit = $debit; $object->debit = $debit;
@ -160,6 +163,7 @@ if ($action == "confirm_update") {
$object->numero_compte = $accountingaccount_number; $object->numero_compte = $accountingaccount_number;
$object->subledger_account = $subledger_account; $object->subledger_account = $subledger_account;
$object->subledger_label = $subledger_label;
$object->label_compte = $accountingaccount_label; $object->label_compte = $accountingaccount_label;
$object->label_operation = $label_operation; $object->label_operation = $label_operation;
$object->debit = $debit; $object->debit = $debit;
@ -578,7 +582,7 @@ if ($action == 'create')
print '<br>'; print '<br>';
$result = $object->fetchAllPerMvt($piece_num, $mode); $result = $object->fetchAllPerMvt($piece_num, $mode); // This load $object->linesmvt
if ($result < 0) { if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} else { } else {
@ -630,9 +634,10 @@ if ($action == 'create')
if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) { if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) {
print $formaccounting->select_auxaccount((GETPOSTISSET("subledger_account") ? GETPOST("subledger_account", "alpha") : $line->subledger_account), 'subledger_account', 1); print $formaccounting->select_auxaccount((GETPOSTISSET("subledger_account") ? GETPOST("subledger_account", "alpha") : $line->subledger_account), 'subledger_account', 1);
} else { } else {
print '<input type="text" class="maxwidth150" name="subledger_account" value="'.(GETPOSTISSET("subledger_account") ? GETPOST("subledger_account", "alpha") : $line->subledger_account).'">'; print '<input type="text" class="maxwidth150" name="subledger_account" value="'.(GETPOSTISSET("subledger_account") ? GETPOST("subledger_account", "alpha") : $line->subledger_account).'" placeholder="'.dol_escape_htmltag($langs->trans("SubledgerAccount")).'">';
} }
// TODO Add also the label // Add also input for subledger label
print '<br><input type="text" class="maxwidth150" name="subledger_label" value="'.(GETPOSTISSET("subledger_label") ? GETPOST("subledger_label", "alpha") : $line->subledger_label).'" placeholder="'.dol_escape_htmltag($langs->trans("SubledgerAccountLabel")).'">';
print '</td>'; print '</td>';
print '<td><input type="text" class="minwidth200" name="label_operation" value="'.(GETPOSTISSET("label_operation") ? GETPOST("label_operation", "alpha") : $line->label_operation).'"></td>'; print '<td><input type="text" class="minwidth200" name="label_operation" value="'.(GETPOSTISSET("label_operation") ? GETPOST("label_operation", "alpha") : $line->label_operation).'"></td>';
print '<td class="right"><input type="text" size="6" class="right" name="debit" value="'.(GETPOSTISSET("debit") ? GETPOST("debit", "alpha") : price($line->debit)).'"></td>'; print '<td class="right"><input type="text" size="6" class="right" name="debit" value="'.(GETPOSTISSET("debit") ? GETPOST("debit", "alpha") : price($line->debit)).'"></td>';
@ -644,20 +649,24 @@ if ($action == 'create')
} else { } else {
$accountingaccount->fetch(null, $line->numero_compte, true); $accountingaccount->fetch(null, $line->numero_compte, true);
print '<td>'.$accountingaccount->getNomUrl(0, 1, 1, '', 0).'</td>'; print '<td>'.$accountingaccount->getNomUrl(0, 1, 1, '', 0).'</td>';
print '<td>'.length_accounta($line->subledger_account).'</td>'; print '<td>'.length_accounta($line->subledger_account);
if ($line->subledger_label) {
print ' - <span class="opacitymedium">'.$line->subledger_label.'</span>';
}
print '</td>';
print '<td>'.$line->label_operation.'</td>'; print '<td>'.$line->label_operation.'</td>';
print '<td class="nowrap right">'.price($line->debit).'</td>'; print '<td class="nowrap right">'.price($line->debit).'</td>';
print '<td class="nowrap right">'.price($line->credit).'</td>'; print '<td class="nowrap right">'.price($line->credit).'</td>';
print '<td class="center">'; print '<td class="center">';
print '<a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?action=update&id='.$line->id.'&piece_num='.$line->piece_num.'&mode='.$mode.'">'; print '<a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?action=update&id='.$line->id.'&piece_num='.urlencode($line->piece_num).'&mode='.urlencode($mode).'&token='.urlencode(newToken()).'">';
print img_edit('', 0, 'class="marginrightonly"'); print img_edit('', 0, 'class="marginrightonly"');
print '</a> &nbsp;'; print '</a> &nbsp;';
$actiontodelete = 'delete'; $actiontodelete = 'delete';
if ($mode == '_tmp' || $action != 'delmouv') $actiontodelete = 'confirm_delete'; if ($mode == '_tmp' || $action != 'delmouv') $actiontodelete = 'confirm_delete';
print '<a href="'.$_SERVER["PHP_SELF"].'?action='.$actiontodelete.'&id='.$line->id.'&piece_num='.$line->piece_num.'&mode='.$mode.'">'; print '<a href="'.$_SERVER["PHP_SELF"].'?action='.$actiontodelete.'&id='.$line->id.'&piece_num='.urlencode($line->piece_num).'&mode='.urlencode($mode).'&token='.urlencode(newToken()).'">';
print img_delete(); print img_delete();
print '</a>'; print '</a>';
@ -688,9 +697,9 @@ if ($action == 'create')
if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) { if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) {
print $formaccounting->select_auxaccount('', 'subledger_account', 1); print $formaccounting->select_auxaccount('', 'subledger_account', 1);
} else { } else {
print '<input type="text" class="maxwidth150" name="subledger_account" value="">'; print '<input type="text" class="maxwidth150" name="subledger_account" value="" placeholder="'.dol_escape_htmltag($langs->trans("SubledgerAccount")).'">';
} }
// TODO Add also the label print '<br><input type="text" class="maxwidth150" name="subledger_label" value="" placeholder="'.dol_escape_htmltag($langs->trans("SubledgerAccountLabel")).'">';
print '</td>'; print '</td>';
print '<td><input type="text" class="minwidth200" name="label_operation" value="'.$label_operation.'"/></td>'; print '<td><input type="text" class="minwidth200" name="label_operation" value="'.$label_operation.'"/></td>';
print '<td class="right"><input type="text" size="6" class="right" name="debit" value=""/></td>'; print '<td class="right"><input type="text" size="6" class="right" name="debit" value=""/></td>';

View File

@ -87,7 +87,7 @@ $search_debit = GETPOST('search_debit', 'alpha');
$search_credit = GETPOST('search_credit', 'alpha'); $search_credit = GETPOST('search_credit', 'alpha');
$search_ledger_code = GETPOST('search_ledger_code', 'array'); $search_ledger_code = GETPOST('search_ledger_code', 'array');
$search_lettering_code = GETPOST('search_lettering_code', 'alpha'); $search_lettering_code = GETPOST('search_lettering_code', 'alpha');
$search_not_reconciled = GETPOST('search_reconciled_option', 'alpha'); $search_not_reconciled = GETPOST('search_not_reconciled', 'alpha');
// Load variable for pagination // 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);
@ -784,7 +784,7 @@ if (!empty($arrayfields['t.lettering_code']['checked']))
{ {
print '<td class="liste_titre center">'; print '<td class="liste_titre center">';
print '<input type="text" size="3" class="flat" name="search_lettering_code" value="'.$search_lettering_code.'"/>'; print '<input type="text" size="3" class="flat" name="search_lettering_code" value="'.$search_lettering_code.'"/>';
print '<br><span class="nowrap"><input type="checkbox" name="search_reconciled_option" value="notreconciled"'.($search_not_reconciled == 'notreconciled' ? ' checked' : '').'>'.$langs->trans("NotReconciled").'</span>'; print '<br><span class="nowrap"><input type="checkbox" name="search_not_reconciled" value="notreconciled"'.($search_not_reconciled == 'notreconciled' ? ' checked' : '').'>'.$langs->trans("NotReconciled").'</span>';
print '</td>'; print '</td>';
} }

View File

@ -74,7 +74,7 @@ $search_ledger_code = GETPOST('search_ledger_code', 'array');
$search_debit = GETPOST('search_debit', 'alpha'); $search_debit = GETPOST('search_debit', 'alpha');
$search_credit = GETPOST('search_credit', 'alpha'); $search_credit = GETPOST('search_credit', 'alpha');
$search_lettering_code = GETPOST('search_lettering_code', 'alpha'); $search_lettering_code = GETPOST('search_lettering_code', 'alpha');
$search_not_reconciled = GETPOST('search_reconciled_option', 'alpha'); $search_not_reconciled = GETPOST('search_not_reconciled', 'alpha');
if (GETPOST("button_delmvt_x") || GETPOST("button_delmvt.x") || GETPOST("button_delmvt")) { if (GETPOST("button_delmvt_x") || GETPOST("button_delmvt.x") || GETPOST("button_delmvt")) {
$action = 'delbookkeepingyear'; $action = 'delbookkeepingyear';
@ -516,7 +516,7 @@ if (!empty($arrayfields['t.lettering_code']['checked']))
{ {
print '<td class="liste_titre center">'; print '<td class="liste_titre center">';
print '<input type="text" size="3" class="flat" name="search_lettering_code" value="'.$search_lettering_code.'"/>'; print '<input type="text" size="3" class="flat" name="search_lettering_code" value="'.$search_lettering_code.'"/>';
print '<br><span class="nowrap"><input type="checkbox" name="search_reconciled_option" value="notreconciled"'.($search_not_reconciled == 'notreconciled' ? ' checked' : '').'>'.$langs->trans("NotReconciled").'</span>'; print '<br><span class="nowrap"><input type="checkbox" name="search_not_reconciled" value="notreconciled"'.($search_not_reconciled == 'notreconciled' ? ' checked' : '').'>'.$langs->trans("NotReconciled").'</span>';
print '</td>'; print '</td>';
} }
// Date export // Date export

View File

@ -74,7 +74,7 @@ $search_ledger_code = GETPOST('search_ledger_code', 'array');
$search_debit = GETPOST('search_debit', 'alpha'); $search_debit = GETPOST('search_debit', 'alpha');
$search_credit = GETPOST('search_credit', 'alpha'); $search_credit = GETPOST('search_credit', 'alpha');
$search_lettering_code = GETPOST('search_lettering_code', 'alpha'); $search_lettering_code = GETPOST('search_lettering_code', 'alpha');
$search_not_reconciled = GETPOST('search_reconciled_option', 'alpha'); $search_not_reconciled = GETPOST('search_not_reconciled', 'alpha');
if (GETPOST("button_delmvt_x") || GETPOST("button_delmvt.x") || GETPOST("button_delmvt")) { if (GETPOST("button_delmvt_x") || GETPOST("button_delmvt.x") || GETPOST("button_delmvt")) {
$action = 'delbookkeepingyear'; $action = 'delbookkeepingyear';
@ -544,7 +544,7 @@ if (!empty($arrayfields['t.credit']['checked'])) {
if (!empty($arrayfields['t.lettering_code']['checked'])) { if (!empty($arrayfields['t.lettering_code']['checked'])) {
print '<td class="liste_titre center">'; print '<td class="liste_titre center">';
print '<input type="text" size="3" class="flat" name="search_lettering_code" value="'.$search_lettering_code.'"/>'; print '<input type="text" size="3" class="flat" name="search_lettering_code" value="'.$search_lettering_code.'"/>';
print '<br><span class="nowrap"><input type="checkbox" name="search_reconciled_option" value="notreconciled"'.($search_not_reconciled == 'notreconciled' ? ' checked' : '').'>'.$langs->trans("NotReconciled").'</span>'; print '<br><span class="nowrap"><input type="checkbox" name="search_not_reconciled" value="notreconciled"'.($search_not_reconciled == 'notreconciled' ? ' checked' : '').'>'.$langs->trans("NotReconciled").'</span>';
print '</td>'; print '</td>';
} }
// Date export // Date export

View File

@ -57,8 +57,8 @@ class AccountancyExport
public static $EXPORT_TYPE_OPENCONCERTO = 100; public static $EXPORT_TYPE_OPENCONCERTO = 100;
public static $EXPORT_TYPE_LDCOMPTA = 110; public static $EXPORT_TYPE_LDCOMPTA = 110;
public static $EXPORT_TYPE_LDCOMPTA10 = 120; public static $EXPORT_TYPE_LDCOMPTA10 = 120;
public static $EXPORT_TYPE_GESTINUMV3 = 130; public static $EXPORT_TYPE_GESTIMUMV3 = 130;
public static $EXPORT_TYPE_GESTINUMV5 = 135; public static $EXPORT_TYPE_GESTIMUMV5 = 135;
public static $EXPORT_TYPE_FEC = 1000; public static $EXPORT_TYPE_FEC = 1000;
public static $EXPORT_TYPE_FEC2 = 1010; public static $EXPORT_TYPE_FEC2 = 1010;
@ -119,8 +119,8 @@ class AccountancyExport
self::$EXPORT_TYPE_CHARLEMAGNE => $langs->trans('Modelcsv_charlemagne'), self::$EXPORT_TYPE_CHARLEMAGNE => $langs->trans('Modelcsv_charlemagne'),
self::$EXPORT_TYPE_LDCOMPTA => $langs->trans('Modelcsv_LDCompta'), self::$EXPORT_TYPE_LDCOMPTA => $langs->trans('Modelcsv_LDCompta'),
self::$EXPORT_TYPE_LDCOMPTA10 => $langs->trans('Modelcsv_LDCompta10'), self::$EXPORT_TYPE_LDCOMPTA10 => $langs->trans('Modelcsv_LDCompta10'),
self::$EXPORT_TYPE_GESTINUMV3 => $langs->trans('Modelcsv_Gestinum_v3'), self::$EXPORT_TYPE_GESTIMUMV3 => $langs->trans('Modelcsv_Gestinum_v3'),
self::$EXPORT_TYPE_GESTINUMV5 => $langs->trans('Modelcsv_Gestinum_v5'), self::$EXPORT_TYPE_GESTIMUMV5 => $langs->trans('Modelcsv_Gestinum_v5'),
self::$EXPORT_TYPE_FEC => $langs->trans('Modelcsv_FEC'), self::$EXPORT_TYPE_FEC => $langs->trans('Modelcsv_FEC'),
self::$EXPORT_TYPE_FEC2 => $langs->trans('Modelcsv_FEC2'), self::$EXPORT_TYPE_FEC2 => $langs->trans('Modelcsv_FEC2'),
); );
@ -154,8 +154,8 @@ class AccountancyExport
self::$EXPORT_TYPE_CHARLEMAGNE => 'charlemagne', self::$EXPORT_TYPE_CHARLEMAGNE => 'charlemagne',
self::$EXPORT_TYPE_LDCOMPTA => 'ldcompta', self::$EXPORT_TYPE_LDCOMPTA => 'ldcompta',
self::$EXPORT_TYPE_LDCOMPTA10 => 'ldcompta10', self::$EXPORT_TYPE_LDCOMPTA10 => 'ldcompta10',
self::$EXPORT_TYPE_GESTINUMV3 => 'gestinumv3', self::$EXPORT_TYPE_GESTIMUMV3 => 'gestimumv3',
self::$EXPORT_TYPE_GESTINUMV5 => 'gestinumv5', self::$EXPORT_TYPE_GESTIMUMV5 => 'gestimumv5',
self::$EXPORT_TYPE_FEC => 'fec', self::$EXPORT_TYPE_FEC => 'fec',
self::$EXPORT_TYPE_FEC2 => 'fec2', self::$EXPORT_TYPE_FEC2 => 'fec2',
); );
@ -227,11 +227,13 @@ class AccountancyExport
self::$EXPORT_TYPE_LDCOMPTA10 => array( self::$EXPORT_TYPE_LDCOMPTA10 => array(
'label' => $langs->trans('Modelcsv_LDCompta10'), 'label' => $langs->trans('Modelcsv_LDCompta10'),
), ),
self::$EXPORT_TYPE_GESTINUMV3 => array( self::$EXPORT_TYPE_GESTIMUMV3 => array(
'label' => $langs->trans('Modelcsv_Gestinumv3'), 'label' => $langs->trans('Modelcsv_Gestinumv3'),
'ACCOUNTING_EXPORT_FORMAT' => 'txt',
), ),
self::$EXPORT_TYPE_GESTINUMV5 => array( self::$EXPORT_TYPE_GESTIMUMV5 => array(
'label' => $langs->trans('Modelcsv_Gestinumv5'), 'label' => $langs->trans('Modelcsv_Gestinumv5'),
'ACCOUNTING_EXPORT_FORMAT' => 'txt',
), ),
self::$EXPORT_TYPE_FEC => array( self::$EXPORT_TYPE_FEC => array(
'label' => $langs->trans('Modelcsv_FEC'), 'label' => $langs->trans('Modelcsv_FEC'),
@ -320,10 +322,10 @@ class AccountancyExport
case self::$EXPORT_TYPE_LDCOMPTA10 : case self::$EXPORT_TYPE_LDCOMPTA10 :
$this->exportLDCompta10($TData); $this->exportLDCompta10($TData);
break; break;
case self::$EXPORT_TYPE_GESTINUMV3 : case self::$EXPORT_TYPE_GESTIMUMV3 :
$this->exportGestimumV3($TData); $this->exportGestimumV3($TData);
break; break;
case self::$EXPORT_TYPE_GESTINUMV5 : case self::$EXPORT_TYPE_GESTIMUMV5 :
$this->exportGestimumV5($TData); $this->exportGestimumV5($TData);
break; break;
case self::$EXPORT_TYPE_FEC : case self::$EXPORT_TYPE_FEC :
@ -1638,81 +1640,85 @@ class AccountancyExport
$invoices_infos = array(); $invoices_infos = array();
$supplier_invoices_infos = array(); $supplier_invoices_infos = array();
foreach ($objectLines as $line) { foreach ($objectLines as $line) {
$date = dol_print_date($line->doc_date, '%d/%m/%Y'); if ($line->debit == 0 && $line->credit == 0) {
unset($array[$line]);
$invoice_ref = $line->doc_ref;
$company_name = "";
if (($line->doc_type == 'customer_invoice' || $line->doc_type == 'supplier_invoice') && $line->fk_doc > 0) {
if (($line->doc_type == 'customer_invoice' && !isset($invoices_infos[$line->fk_doc])) ||
($line->doc_type == 'supplier_invoice' && !isset($supplier_invoices_infos[$line->fk_doc]))) {
if ($line->doc_type == 'customer_invoice') {
// Get new customer invoice ref and company name
$sql = 'SELECT f.ref, s.nom FROM ' . MAIN_DB_PREFIX . 'facture as f';
$sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'societe AS s ON f.fk_soc = s.rowid';
$sql .= ' WHERE f.rowid = ' . $line->fk_doc;
$resql = $this->db->query($sql);
if ($resql) {
if ($obj = $this->db->fetch_object($resql)) {
// Save invoice infos
$invoices_infos[$line->fk_doc] = array('ref' => $obj->ref, 'company_name' => $obj->nom);
$invoice_ref = $obj->ref;
$company_name = $obj->nom;
}
}
} else {
// Get new supplier invoice ref and company name
$sql = 'SELECT ff.ref, s.nom FROM ' . MAIN_DB_PREFIX . 'facture_fourn as ff';
$sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'societe AS s ON ff.fk_soc = s.rowid';
$sql .= ' WHERE ff.rowid = ' . $line->fk_doc;
$resql = $this->db->query($sql);
if ($resql) {
if ($obj = $this->db->fetch_object($resql)) {
// Save invoice infos
$supplier_invoices_infos[$line->fk_doc] = array('ref' => $obj->ref, 'company_name' => $obj->nom);
$invoice_ref = $obj->ref;
$company_name = $obj->nom;
}
}
}
} elseif ($line->doc_type == 'customer_invoice') {
// Retrieve invoice infos
$invoice_ref = $invoices_infos[$line->fk_doc]['ref'];
$company_name = $invoices_infos[$line->fk_doc]['company_name'];
} else {
// Retrieve invoice infos
$invoice_ref = $supplier_invoices_infos[$line->fk_doc]['ref'];
$company_name = $supplier_invoices_infos[$line->fk_doc]['company_name'];
}
}
print $line->id . $this->separator;
print $date . $this->separator;
print substr($line->code_journal, 0, 4) . $this->separator;
if ((substr($line->numero_compte, 0, 3) == '411') || (substr($line->numero_compte, 0, 3) == '401')) {
print length_accountg($line->subledger_account) . $this->separator;
} else { } else {
print substr(length_accountg($line->numero_compte), 0, 15) . $this->separator; $date = dol_print_date($line->doc_date, '%d/%m/%Y');
$invoice_ref = $line->doc_ref;
$company_name = "";
if (($line->doc_type == 'customer_invoice' || $line->doc_type == 'supplier_invoice') && $line->fk_doc > 0) {
if (($line->doc_type == 'customer_invoice' && !isset($invoices_infos[$line->fk_doc])) ||
($line->doc_type == 'supplier_invoice' && !isset($supplier_invoices_infos[$line->fk_doc]))) {
if ($line->doc_type == 'customer_invoice') {
// Get new customer invoice ref and company name
$sql = 'SELECT f.ref, s.nom FROM ' . MAIN_DB_PREFIX . 'facture as f';
$sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'societe AS s ON f.fk_soc = s.rowid';
$sql .= ' WHERE f.rowid = ' . $line->fk_doc;
$resql = $this->db->query($sql);
if ($resql) {
if ($obj = $this->db->fetch_object($resql)) {
// Save invoice infos
$invoices_infos[$line->fk_doc] = array('ref' => $obj->ref, 'company_name' => $obj->nom);
$invoice_ref = $obj->ref;
$company_name = $obj->nom;
}
}
} else {
// Get new supplier invoice ref and company name
$sql = 'SELECT ff.ref, s.nom FROM ' . MAIN_DB_PREFIX . 'facture_fourn as ff';
$sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'societe AS s ON ff.fk_soc = s.rowid';
$sql .= ' WHERE ff.rowid = ' . $line->fk_doc;
$resql = $this->db->query($sql);
if ($resql) {
if ($obj = $this->db->fetch_object($resql)) {
// Save invoice infos
$supplier_invoices_infos[$line->fk_doc] = array('ref' => $obj->ref, 'company_name' => $obj->nom);
$invoice_ref = $obj->ref;
$company_name = $obj->nom;
}
}
}
} elseif ($line->doc_type == 'customer_invoice') {
// Retrieve invoice infos
$invoice_ref = $invoices_infos[$line->fk_doc]['ref'];
$company_name = $invoices_infos[$line->fk_doc]['company_name'];
} else {
// Retrieve invoice infos
$invoice_ref = $supplier_invoices_infos[$line->fk_doc]['ref'];
$company_name = $supplier_invoices_infos[$line->fk_doc]['company_name'];
}
}
print $line->id . $this->separator;
print $date . $this->separator;
print substr($line->code_journal, 0, 4) . $this->separator;
if ((substr($line->numero_compte, 0, 3) == '411') || (substr($line->numero_compte, 0, 3) == '401')) {
print length_accountg($line->subledger_account) . $this->separator;
} else {
print substr(length_accountg($line->numero_compte), 0, 15) . $this->separator;
}
//Libellé Auto
print $this->separator;
//print '"'.dol_trunc(str_replace('"', '', $line->label_operation),40,'right','UTF-8',1).'"' . $this->separator;
//Libellé manuel
print dol_trunc(str_replace('"', '', $invoice_ref . (!empty($company_name) ? ' - ' : '') . $company_name), 40, 'right', 'UTF-8', 1) . $this->separator;
//Numéro de pièce
print dol_trunc(str_replace('"', '', $line->piece_num), 10, 'right', 'UTF-8', 1) . $this->separator;
//Devise
print 'EUR' . $this->separator;
//Montant
print price2num(abs($line->montant)) . $this->separator;
//Sens
print $line->sens . $this->separator;
//Code lettrage
print $this->separator;
//Date Echéance
print $date;
print $this->end_line;
} }
//Libellé Auto
print $this->separator;
//print '"'.dol_trunc(str_replace('"', '', $line->label_operation),40,'right','UTF-8',1).'"' . $this->separator;
//Libellé manuel
print dol_trunc(str_replace('"', '', $invoice_ref . (!empty($company_name) ? ' - ' : '') . $company_name), 40, 'right', 'UTF-8', 1) . $this->separator;
//Numéro de pièce
print dol_trunc(str_replace('"', '', $line->piece_num), 10, 'right', 'UTF-8', 1) . $this->separator;
//Devise
print 'EUR' . $this->separator;
//Montant
print price2num(abs($line->montant)) . $this->separator;
//Sens
print $line->sens . $this->separator;
//Code lettrage
print $this->separator;
//Date Echéance
print $date;
print $this->end_line;
} }
} }
@ -1729,27 +1735,31 @@ class AccountancyExport
$this->separator = ','; $this->separator = ',';
foreach ($objectLines as $line) { foreach ($objectLines as $line) {
$date = dol_print_date($line->doc_date, '%d%m%Y'); if ($line->debit == 0 && $line->credit == 0) {
unset($array[$line]);
print $line->id . $this->separator;
print $date . $this->separator;
print substr($line->code_journal, 0, 4) . $this->separator;
if ((substr($line->numero_compte, 0, 3) == '411') || (substr($line->numero_compte, 0, 3) == '401')) {
print length_accountg($line->subledger_account) . $this->separator;
} else { } else {
print substr(length_accountg($line->numero_compte), 0, 15) . $this->separator; $date = dol_print_date($line->doc_date, '%d%m%Y');
print $line->id . $this->separator;
print $date . $this->separator;
print substr($line->code_journal, 0, 4) . $this->separator;
if ((substr($line->numero_compte, 0, 3) == '411') || (substr($line->numero_compte, 0, 3) == '401')) {
print length_accountg($line->subledger_account) . $this->separator;
} else {
print substr(length_accountg($line->numero_compte), 0, 15) . $this->separator;
}
print $this->separator;
//print '"'.dol_trunc(str_replace('"', '', $line->label_operation),40,'right','UTF-8',1).'"' . $this->separator;
print '"' . dol_trunc(str_replace('"', '', $line->doc_ref), 40, 'right', 'UTF-8', 1) . '"' . $this->separator;
print '"' . dol_trunc(str_replace('"', '', $line->piece_num), 10, 'right', 'UTF-8', 1) . '"' . $this->separator;
print price2num($line->montant) . $this->separator;
print $line->sens . $this->separator;
print $date . $this->separator;
print $this->separator;
print $this->separator;
print 'EUR';
print $this->end_line;
} }
print $this->separator;
//print '"'.dol_trunc(str_replace('"', '', $line->label_operation),40,'right','UTF-8',1).'"' . $this->separator;
print '"'.dol_trunc(str_replace('"', '', $line->doc_ref), 40, 'right', 'UTF-8', 1).'"' . $this->separator;
print '"'.dol_trunc(str_replace('"', '', $line->piece_num), 10, 'right', 'UTF-8', 1).'"'.$this->separator;
print price2num($line->montant).$this->separator;
print $line->sens.$this->separator;
print $date . $this->separator;
print $this->separator;
print $this->separator;
print 'EUR';
print $this->end_line;
} }
} }

View File

@ -370,7 +370,7 @@ class BookKeeping extends CommonObject
$sql .= ", ".(!empty($this->subledger_account) ? ("'".$this->db->escape($this->subledger_account)."'") : "NULL"); $sql .= ", ".(!empty($this->subledger_account) ? ("'".$this->db->escape($this->subledger_account)."'") : "NULL");
$sql .= ", ".(!empty($this->subledger_label) ? ("'".$this->db->escape($this->subledger_label)."'") : "NULL"); $sql .= ", ".(!empty($this->subledger_label) ? ("'".$this->db->escape($this->subledger_label)."'") : "NULL");
$sql .= ", '".$this->db->escape($this->numero_compte)."'"; $sql .= ", '".$this->db->escape($this->numero_compte)."'";
$sql .= ", ".(!empty($this->label_operation) ? ("'".$this->db->escape($this->label_operation)."'") : "NULL"); $sql .= ", ".(!empty($this->label_compte) ? ("'".$this->db->escape($this->label_compte)."'") : "NULL");
$sql .= ", '".$this->db->escape($this->label_operation)."'"; $sql .= ", '".$this->db->escape($this->label_operation)."'";
$sql .= ", ".$this->debit; $sql .= ", ".$this->debit;
$sql .= ", ".$this->credit; $sql .= ", ".$this->credit;
@ -1914,25 +1914,24 @@ class BookKeeping extends CommonObject
/** /**
* Return id and description of a root accounting account. * Return id and description of a root accounting account.
* This function takes the parent of parent to get the root account ! * FIXME: This function takes the parent of parent to get the root account !
* *
* @param string $account Accounting account * @param string $account Accounting account
* @return string Root account * @return array Array with root account information (max 2 upper level)
*/ */
public function getRootAccount($account = null) public function getRootAccount($account = null)
{ {
global $conf; global $conf;
$pcgver = $conf->global->CHARTOFACCOUNTS; $pcgver = $conf->global->CHARTOFACCOUNTS;
$sql = "SELECT root.rowid, root.account_number, root.label as label"; $sql = "SELECT root.rowid, root.account_number, root.label as label,";
$sql .= " parent.rowid as parent_rowid, parent.account_number as parent_account_number, parent.label as parent_label";
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as aa"; $sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as aa";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
$sql .= " AND asy.rowid = ".((int) $pcgver); $sql .= " AND asy.rowid = ".((int) $pcgver);
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as parent ON aa.account_parent = parent.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as parent ON aa.account_parent = parent.rowid AND parent.active = 1";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as root ON parent.account_parent = root.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as root ON parent.account_parent = root.rowid AND root.active = 1";
$sql .= " WHERE aa.account_number = '".$this->db->escape($account)."'"; $sql .= " WHERE aa.account_number = '".$this->db->escape($account)."'";
$sql .= " AND parent.active = 1";
$sql .= " AND root.active = 1";
$sql .= " AND aa.entity IN (".getEntity('accountancy').")"; $sql .= " AND aa.entity IN (".getEntity('accountancy').")";
dol_syslog(get_class($this)."::select_account sql=".$sql, LOG_DEBUG); dol_syslog(get_class($this)."::select_account sql=".$sql, LOG_DEBUG);
@ -1943,7 +1942,8 @@ class BookKeeping extends CommonObject
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
} }
return array('id'=>$obj->rowid, 'account_number'=>$obj->account_number, 'label'=>$obj->label); $result = array('id'=>$obj->rowid, 'account_number'=>$obj->account_number, 'label'=>$obj->label);
return $result;
} else { } else {
$this->error = "Error ".$this->db->lasterror(); $this->error = "Error ".$this->db->lasterror();
dol_syslog(__METHOD__." ".$this->error, LOG_ERR); dol_syslog(__METHOD__." ".$this->error, LOG_ERR);

View File

@ -37,7 +37,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("bills", "compta", "accountancy", "productbatch")); $langs->loadLangs(array("bills", "compta", "accountancy", "productbatch", "products"));
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
@ -339,7 +339,7 @@ if ($result) {
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, fd.rowid", "", $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, fd.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
//print_liste_field_titre("ProductLabel", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder); //print_liste_field_titre("ProductLabel", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "fd.description", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("ProductDescription", $_SERVER["PHP_SELF"], "fd.description", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "fd.total_ht", "", $param, '', $sortfield, $sortorder, 'right '); print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "fd.total_ht", "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "fd.tva_tx", "", $param, '', $sortfield, $sortorder, 'right '); print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "fd.tva_tx", "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder);

View File

@ -38,7 +38,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("bills", "companies", "compta", "accountancy", "other", "productbatch")); $langs->loadLangs(array("bills", "companies", "compta", "accountancy", "other", "productbatch", "products"));
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$massaction = GETPOST('massaction', 'alpha'); $massaction = GETPOST('massaction', 'alpha');

View File

@ -150,7 +150,7 @@ $userstatic = new User($db);
$bankaccountstatic = new Account($db); $bankaccountstatic = new Account($db);
$chargestatic = new ChargeSociales($db); $chargestatic = new ChargeSociales($db);
$paymentdonstatic = new PaymentDonation($db); $paymentdonstatic = new PaymentDonation($db);
$paymentvatstatic = new TVA($db); $paymentvatstatic = new Tva($db);
$paymentsalstatic = new PaymentSalary($db); $paymentsalstatic = new PaymentSalary($db);
$paymentexpensereportstatic = new PaymentExpenseReport($db); $paymentexpensereportstatic = new PaymentExpenseReport($db);
$paymentvariousstatic = new PaymentVarious($db); $paymentvariousstatic = new PaymentVarious($db);

View File

@ -38,7 +38,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("compta", "bills", "other", "accountancy", "productbatch")); $langs->loadLangs(array("compta", "bills", "other", "accountancy", "productbatch", "products"));
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
@ -334,16 +334,16 @@ if ($result) {
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("InvoiceLabel", $_SERVER["PHP_SELF"], "f.libelle", "", $param, '', $sortfield, $sortorder); //print_liste_field_titre("InvoiceLabel", $_SERVER["PHP_SELF"], "f.libelle", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
//print_liste_field_titre("ProductLabel", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder); //print_liste_field_titre("ProductLabel", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("ProductDescription", $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "l.total_ht", "", $param, '', $sortfield, $sortorder, 'right '); print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "l.total_ht", "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, '', $sortfield, $sortorder, 'right '); print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("VATIntra", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("VATIntraShort", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("AccountAccounting", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("AccountAccounting", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder);
$checkpicto = $form->showCheckAddButtons(); $checkpicto = $form->showCheckAddButtons();
print_liste_field_titre($checkpicto, '', '', '', '', '', '', '', 'center '); print_liste_field_titre($checkpicto, '', '', '', '', '', '', '', 'center ');

View File

@ -39,7 +39,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("bills", "companies", "compta", "accountancy", "other", "productbatch")); $langs->loadLangs(array("bills", "companies", "compta", "accountancy", "other", "productbatch", "products"));
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$massaction = GETPOST('massaction', 'alpha'); $massaction = GETPOST('massaction', 'alpha');

View File

@ -136,7 +136,7 @@ if ($action == 'update' || $action == 'add') {
$constnote = GETPOST('constnote'); $constnote = GETPOST('constnote');
$res = dolibarr_set_const($db, $constname, $constvalue, $choices[$consttype], 0, $constnote, $conf->entity); $res = dolibarr_set_const($db, $constname, $constvalue, $choices[$consttype], 0, $constnote, $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
if (!$error) { if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');

View File

@ -92,7 +92,7 @@ if ($action == 'update' || $action == 'add') {
$res = dolibarr_set_const($db, $constname, $constvalue, $typetouse, 0, $constnote, $conf->entity); $res = dolibarr_set_const($db, $constname, $constvalue, $typetouse, 0, $constnote, $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
if (!$error) { if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');

View File

@ -63,7 +63,7 @@ if ($action == 'update') {
$res = dolibarr_set_const($db, "MEMBER_NEWFORM_FORCETYPE", $forcetype, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "MEMBER_NEWFORM_FORCETYPE", $forcetype, 'chaine', 0, '', $conf->entity);
} }
if (!$res > 0) $error++; if (!($res > 0)) $error++;
if (!$error) { if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');

View File

@ -97,7 +97,7 @@ if ($action == "save" && empty($cancel))
if ($search_event === '' || preg_match('/'.preg_quote($search_event, '/').'/i', $keyparam)) if ($search_event === '' || preg_match('/'.preg_quote($search_event, '/').'/i', $keyparam))
{ {
$res = dolibarr_set_const($db, $keyparam, (GETPOST($keyparam, 'alpha') ?GETPOST($keyparam, 'alpha') : ''), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, $keyparam, (GETPOST($keyparam, 'alpha') ?GETPOST($keyparam, 'alpha') : ''), 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
} }
} }

View File

@ -82,15 +82,15 @@ if ($actionsave)
//print '-name='.$name.'-color='.$color; //print '-name='.$name.'-color='.$color;
$res = dolibarr_set_const($db, 'AGENDA_EXT_NAME'.$i, $name, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, 'AGENDA_EXT_NAME'.$i, $name, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
$res = dolibarr_set_const($db, 'AGENDA_EXT_SRC'.$i, $src, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, 'AGENDA_EXT_SRC'.$i, $src, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
$res = dolibarr_set_const($db, 'AGENDA_EXT_OFFSETTZ'.$i, $offsettz, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, 'AGENDA_EXT_OFFSETTZ'.$i, $offsettz, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
$res = dolibarr_set_const($db, 'AGENDA_EXT_COLOR'.$i, $color, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, 'AGENDA_EXT_COLOR'.$i, $color, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
$res = dolibarr_set_const($db, 'AGENDA_EXT_ENABLED'.$i, $enabled, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, 'AGENDA_EXT_ENABLED'.$i, $enabled, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
$i++; $i++;
} }
@ -98,7 +98,7 @@ if ($actionsave)
if (!$error) if (!$error)
{ {
$res = dolibarr_set_const($db, 'AGENDA_EXT_NB', trim(GETPOST('AGENDA_EXT_NB', 'int')), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, 'AGENDA_EXT_NB', trim(GETPOST('AGENDA_EXT_NB', 'int')), 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
if (empty($conf->global->AGENDA_EXT_NB)) $conf->global->AGENDA_EXT_NB = 5; if (empty($conf->global->AGENDA_EXT_NB)) $conf->global->AGENDA_EXT_NB = 5;
$MAXAGENDA = empty($conf->global->AGENDA_EXT_NB) ? 5 : $conf->global->AGENDA_EXT_NB; $MAXAGENDA = empty($conf->global->AGENDA_EXT_NB) ? 5 : $conf->global->AGENDA_EXT_NB;
} }

View File

@ -51,6 +51,7 @@ $type = 'action';
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
$reg = array();
if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg))
{ {
$code = $reg[1]; $code = $reg[1];

View File

@ -112,7 +112,7 @@ if ($actionsave)
if ($color == '-1') $color = ''; if ($color == '-1') $color = '';
$res = dolibarr_set_const($db, 'BANK_COLORIZE_MOVEMENT_COLOR'.$i, $color, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, 'BANK_COLORIZE_MOVEMENT_COLOR'.$i, $color, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
$i++; $i++;
} }

View File

@ -52,7 +52,7 @@ if ($action == 'updateMask')
if ($maskconstbom) $res = dolibarr_set_const($db, $maskconstbom, $maskbom, 'chaine', 0, '', $conf->entity); if ($maskconstbom) $res = dolibarr_set_const($db, $maskconstbom, $maskbom, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
if (!$error) if (!$error)
{ {
@ -141,7 +141,7 @@ elseif ($action == 'setdoc')
$draft = GETPOST("BOM_DRAFT_WATERMARK"); $draft = GETPOST("BOM_DRAFT_WATERMARK");
$res = dolibarr_set_const($db, "BOM_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "BOM_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
if (!$error) if (!$error)
{ {
@ -155,7 +155,7 @@ elseif ($action == 'setdoc')
$res = dolibarr_set_const($db, "BOM_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "BOM_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
if (!$error) if (!$error)
{ {

View File

@ -55,7 +55,7 @@ if ($action == 'updateMask')
$maskchequereceipts = GETPOST('maskchequereceipts', 'alpha'); $maskchequereceipts = GETPOST('maskchequereceipts', 'alpha');
if ($maskconstchequereceipts) $res = dolibarr_set_const($db, $maskconstchequereceipts, $maskchequereceipts, 'chaine', 0, '', $conf->entity); if ($maskconstchequereceipts) $res = dolibarr_set_const($db, $maskconstchequereceipts, $maskchequereceipts, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
if (!$error) if (!$error)
{ {
@ -76,7 +76,7 @@ if ($action == 'set_BANK_CHEQUERECEIPT_FREE_TEXT')
$res = dolibarr_set_const($db, "BANK_CHEQUERECEIPT_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "BANK_CHEQUERECEIPT_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
if (!$error) if (!$error)
{ {

View File

@ -61,7 +61,7 @@ if ($action == 'updateMask')
if ($maskconstorder) $res = dolibarr_set_const($db, $maskconstorder, $maskorder, 'chaine', 0, '', $conf->entity); if ($maskconstorder) $res = dolibarr_set_const($db, $maskconstorder, $maskorder, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
if (!$error) if (!$error)
{ {
@ -146,7 +146,7 @@ elseif ($action == 'setdoc') {
$draft = GETPOST("COMMANDE_DRAFT_WATERMARK"); $draft = GETPOST("COMMANDE_DRAFT_WATERMARK");
$res = dolibarr_set_const($db, "COMMANDE_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "COMMANDE_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
if (!$error) if (!$error)
{ {
@ -160,7 +160,7 @@ elseif ($action == 'setdoc') {
$res = dolibarr_set_const($db, "ORDER_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "ORDER_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
if (!$error) if (!$error)
{ {
@ -172,7 +172,7 @@ elseif ($action == 'setdoc') {
// Activate Set Shippable Icon In List // Activate Set Shippable Icon In List
$setshippableiconinlist = GETPOST('value', 'int'); $setshippableiconinlist = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "SHIPPABLE_ORDER_ICON_IN_LIST", $setshippableiconinlist, 'yesno', 0, '', $conf->entity); $res = dolibarr_set_const($db, "SHIPPABLE_ORDER_ICON_IN_LIST", $setshippableiconinlist, 'yesno', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
if (!$error) { if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else { } else {
@ -186,7 +186,7 @@ elseif ($action == 'setdoc') {
$res = dolibarr_set_const($db, "FACTURE_RIB_NUMBER", $rib, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "FACTURE_RIB_NUMBER", $rib, 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "FACTURE_CHQ_NUMBER", $chq, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "FACTURE_CHQ_NUMBER", $chq, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
if (!$error) if (!$error)
{ {
@ -201,7 +201,7 @@ elseif ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_ORDER')
{ {
$res = dolibarr_set_const($db, "BANK_ASK_PAYMENT_BANK_DURING_ORDER", $value, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "BANK_ASK_PAYMENT_BANK_DURING_ORDER", $value, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
if (!$error) if (!$error)
{ {
@ -216,7 +216,7 @@ elseif ($action == 'set_WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER')
{ {
$res = dolibarr_set_const($db, "WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER", $value, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER", $value, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
if (!$error) if (!$error)
{ {

View File

@ -57,7 +57,7 @@ if ($action == 'updateMask')
$maskvalue = GETPOST('maskcontract', 'alpha'); $maskvalue = GETPOST('maskcontract', 'alpha');
if ($maskconst) $res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity); if ($maskconst) $res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
if (!$error) if (!$error)
{ {

View File

@ -58,7 +58,7 @@ if ($action == 'updateMask')
$maskdelivery = GETPOST('maskdelivery', 'alpha'); $maskdelivery = GETPOST('maskdelivery', 'alpha');
if ($maskconstdelivery) $res = dolibarr_set_const($db, $maskconstdelivery, $maskdelivery, 'chaine', 0, '', $conf->entity); if ($maskconstdelivery) $res = dolibarr_set_const($db, $maskconstdelivery, $maskdelivery, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
if (!$error) if (!$error)
{ {
@ -73,7 +73,7 @@ if ($action == 'set_DELIVERY_FREE_TEXT')
$free = GETPOST('DELIVERY_FREE_TEXT', 'restricthtml'); // No alpha here, we want exact string $free = GETPOST('DELIVERY_FREE_TEXT', 'restricthtml'); // No alpha here, we want exact string
$res = dolibarr_set_const($db, "DELIVERY_FREE_TEXT", $free, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "DELIVERY_FREE_TEXT", $free, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
if (!$error) if (!$error)
{ {

View File

@ -236,7 +236,7 @@ $tabsqlsort[3] = "country ASC, code ASC";
$tabsqlsort[4] = "code ASC"; $tabsqlsort[4] = "code ASC";
$tabsqlsort[5] = "label ASC"; $tabsqlsort[5] = "label ASC";
$tabsqlsort[6] = "a.type ASC, a.module ASC, a.position ASC, a.code ASC"; $tabsqlsort[6] = "a.type ASC, a.module ASC, a.position ASC, a.code ASC";
$tabsqlsort[7] = "country ASC, code ASC, a.libelle ASC"; $tabsqlsort[7] = "c.label ASC, a.code ASC, a.libelle ASC";
$tabsqlsort[8] = "country DESC,".(!empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? ' t.position ASC,' : '')." libelle ASC"; $tabsqlsort[8] = "country DESC,".(!empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? ' t.position ASC,' : '')." libelle ASC";
$tabsqlsort[9] = "label ASC"; $tabsqlsort[9] = "label ASC";
$tabsqlsort[10] = "country ASC, code ASC, taux ASC, recuperableonly ASC, localtax1 ASC, localtax2 ASC"; $tabsqlsort[10] = "country ASC, code ASC, taux ASC, recuperableonly ASC, localtax1 ASC, localtax2 ASC";
@ -1069,6 +1069,7 @@ if ($id)
elseif ($search_code != '' && $id == 28) $sql .= natural_search("h.code", $search_code); elseif ($search_code != '' && $id == 28) $sql .= natural_search("h.code", $search_code);
elseif ($search_code != '' && $id == 32) $sql .= natural_search("a.code", $search_code); elseif ($search_code != '' && $id == 32) $sql .= natural_search("a.code", $search_code);
elseif ($search_code != '' && $id == 3) $sql .= natural_search("r.code_region", $search_code); elseif ($search_code != '' && $id == 3) $sql .= natural_search("r.code_region", $search_code);
elseif ($search_code != '' && $id == 7) $sql .= natural_search("a.code", $search_code);
elseif ($search_code != '' && $id != 9) $sql .= natural_search("code", $search_code); elseif ($search_code != '' && $id != 9) $sql .= natural_search("code", $search_code);
if ($sortfield) if ($sortfield)
@ -1107,7 +1108,6 @@ if ($id)
// Form to add a new line // Form to add a new line
if ($tabname[$id]) if ($tabname[$id])
{ {
$alabelisused = 0;
$withentity = null; $withentity = null;
$fieldlist = explode(',', $tabfield[$id]); $fieldlist = explode(',', $tabfield[$id]);
@ -1214,7 +1214,6 @@ if ($id)
else $tdsoffields .= $valuetoshow; else $tdsoffields .= $valuetoshow;
$tdsoffields .= '</td>'; $tdsoffields .= '</td>';
} }
if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') $alabelisused = 1;
} }
if ($id == 4) $tdsoffields .= '<td></td>'; if ($id == 4) $tdsoffields .= '<td></td>';

View File

@ -61,7 +61,7 @@ if ($action == 'updateMask') {
$res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity);
} }
if (!$res > 0) { if (!($res > 0)) {
$error++; $error++;
} }

View File

@ -66,7 +66,7 @@ if ($action == 'updateMask')
if ($maskconstcredit) $res = dolibarr_set_const($db, $maskconstcredit, $maskcredit, 'chaine', 0, '', $conf->entity); if ($maskconstcredit) $res = dolibarr_set_const($db, $maskconstcredit, $maskcredit, 'chaine', 0, '', $conf->entity);
if ($maskconstdeposit) $res = dolibarr_set_const($db, $maskconstdeposit, $maskdeposit, 'chaine', 0, '', $conf->entity); if ($maskconstdeposit) $res = dolibarr_set_const($db, $maskconstdeposit, $maskdeposit, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
if (!$error) if (!$error)
{ {
@ -156,7 +156,7 @@ elseif ($action == 'setdoc')
$res = dolibarr_set_const($db, "FACTURE_RIB_NUMBER", $rib, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "FACTURE_RIB_NUMBER", $rib, 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "FACTURE_CHQ_NUMBER", $chq, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "FACTURE_CHQ_NUMBER", $chq, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
if (!$error) if (!$error)
{ {
@ -170,7 +170,7 @@ elseif ($action == 'setdoc')
$res = dolibarr_set_const($db, "FACTURE_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "FACTURE_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
if (!$error) if (!$error)
{ {
@ -184,7 +184,7 @@ elseif ($action == 'setdoc')
$res = dolibarr_set_const($db, "INVOICE_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "INVOICE_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
if (!$error) if (!$error)
{ {
@ -198,7 +198,7 @@ elseif ($action == 'setdoc')
$res = dolibarr_set_const($db, "FAC_FORCE_DATE_VALIDATION", $forcedate, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "FAC_FORCE_DATE_VALIDATION", $forcedate, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
if (!$error) if (!$error)
{ {
@ -217,7 +217,7 @@ elseif ($action == 'setdoc')
foreach ($invoicetypemodels as $type => $value) foreach ($invoicetypemodels as $type => $value)
{ {
$res = dolibarr_set_const($db, 'FACTURE_ADDON_PDF_'.intval($type), $value, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, 'FACTURE_ADDON_PDF_'.intval($type), $value, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
} }
if (!$error) if (!$error)

View File

@ -58,7 +58,7 @@ if ($action == 'updateMask')
$maskvalue = GETPOST('maskvalue', 'alpha'); $maskvalue = GETPOST('maskvalue', 'alpha');
if ($maskconst) $res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity); if ($maskconst) $res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
if (!$error) if (!$error)
{ {
@ -147,7 +147,7 @@ elseif ($action == 'setdoc')
$freetext = GETPOST('FICHINTER_FREE_TEXT', 'restricthtml'); // No alpha here, we want exact string $freetext = GETPOST('FICHINTER_FREE_TEXT', 'restricthtml'); // No alpha here, we want exact string
$res = dolibarr_set_const($db, "FICHINTER_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "FICHINTER_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
if (!$error) if (!$error)
{ {
@ -160,7 +160,7 @@ elseif ($action == 'setdoc')
$draft = GETPOST('FICHINTER_DRAFT_WATERMARK', 'alpha'); $draft = GETPOST('FICHINTER_DRAFT_WATERMARK', 'alpha');
$res = dolibarr_set_const($db, "FICHINTER_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "FICHINTER_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
if (!$error) if (!$error)
{ {
@ -173,7 +173,7 @@ elseif ($action == 'setdoc')
$val = GETPOST('FICHINTER_PRINT_PRODUCTS', 'alpha'); $val = GETPOST('FICHINTER_PRINT_PRODUCTS', 'alpha');
$res = dolibarr_set_const($db, "FICHINTER_PRINT_PRODUCTS", ($val == 'on' ? 1 : 0), 'bool', 0, '', $conf->entity); $res = dolibarr_set_const($db, "FICHINTER_PRINT_PRODUCTS", ($val == 'on' ? 1 : 0), 'bool', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
if (!$error) if (!$error)
{ {
@ -185,7 +185,7 @@ elseif ($action == 'setdoc')
$val = GETPOST('FICHINTER_USE_SERVICE_DURATION', 'alpha'); $val = GETPOST('FICHINTER_USE_SERVICE_DURATION', 'alpha');
$res = dolibarr_set_const($db, "FICHINTER_USE_SERVICE_DURATION", ($val == 'on' ? 1 : 0), 'bool', 0, '', $conf->entity); $res = dolibarr_set_const($db, "FICHINTER_USE_SERVICE_DURATION", ($val == 'on' ? 1 : 0), 'bool', 0, '', $conf->entity);
if (!$res > 0) { if (!($res > 0)) {
$error++; $error++;
} }
@ -198,7 +198,7 @@ elseif ($action == 'setdoc')
$val = GETPOST('FICHINTER_WITHOUT_DURATION', 'alpha'); $val = GETPOST('FICHINTER_WITHOUT_DURATION', 'alpha');
$res = dolibarr_set_const($db, "FICHINTER_WITHOUT_DURATION", ($val == 'on' ? 1 : 0), 'bool', 0, '', $conf->entity); $res = dolibarr_set_const($db, "FICHINTER_WITHOUT_DURATION", ($val == 'on' ? 1 : 0), 'bool', 0, '', $conf->entity);
if (!$res > 0) { if (!($res > 0)) {
$error++; $error++;
} }
@ -211,7 +211,7 @@ elseif ($action == 'setdoc')
$val = GETPOST('FICHINTER_DATE_WITHOUT_HOUR', 'alpha'); $val = GETPOST('FICHINTER_DATE_WITHOUT_HOUR', 'alpha');
$res = dolibarr_set_const($db, "FICHINTER_DATE_WITHOUT_HOUR", ($val == 'on' ? 1 : 0), 'bool', 0, '', $conf->entity); $res = dolibarr_set_const($db, "FICHINTER_DATE_WITHOUT_HOUR", ($val == 'on' ? 1 : 0), 'bool', 0, '', $conf->entity);
if (!$res > 0) { if (!($res > 0)) {
$error++; $error++;
} }

View File

@ -59,7 +59,7 @@ if ($action == 'updateMask')
$maskvalue = GETPOST('maskholiday', 'alpha'); $maskvalue = GETPOST('maskholiday', 'alpha');
if ($maskconst) $res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity); if ($maskconst) $res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
if (!$error) if (!$error)
{ {

View File

@ -36,6 +36,7 @@ $action = GETPOST('action', 'aZ09');
$form = new Form($db); $form = new Form($db);
/* /*
* Actions * Actions
*/ */
@ -52,21 +53,20 @@ if ($action == 'setvalue')
$contactbulkdefault = GETPOST('MAILING_CONTACT_DEFAULT_BULK_STATUS', 'int'); $contactbulkdefault = GETPOST('MAILING_CONTACT_DEFAULT_BULK_STATUS', 'int');
$res = dolibarr_set_const($db, "MAILING_EMAIL_FROM", $mailfrom, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "MAILING_EMAIL_FROM", $mailfrom, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
$res = dolibarr_set_const($db, "MAILING_EMAIL_ERRORSTO", $mailerror, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "MAILING_EMAIL_ERRORSTO", $mailerror, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
$res = dolibarr_set_const($db, "MAILING_DELAY", $mailingdelay, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "MAILING_DELAY", $mailingdelay, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
$res = dolibarr_set_const($db, "MAILING_CONTACT_DEFAULT_BULK_STATUS", $contactbulkdefault, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "MAILING_CONTACT_DEFAULT_BULK_STATUS", $contactbulkdefault, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
// Create temporary encryption key if nedded // Create temporary encryption key if nedded
$res = dolibarr_set_const($db, "MAILING_EMAIL_UNSUBSCRIBE_KEY", $checkread_key, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "MAILING_EMAIL_UNSUBSCRIBE_KEY", $checkread_key, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
if (!$error) if (!$error) {
{
$db->commit(); $db->commit();
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else { } else {
@ -77,7 +77,7 @@ if ($action == 'setvalue')
if ($action == 'setonsearchandlistgooncustomerorsuppliercard') { if ($action == 'setonsearchandlistgooncustomerorsuppliercard') {
$setonsearchandlistgooncustomerorsuppliercard = GETPOST('value', 'int'); $setonsearchandlistgooncustomerorsuppliercard = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "SOCIETE_ON_SEARCH_AND_LIST_GO_ON_CUSTOMER_OR_SUPPLIER_CARD", $setonsearchandlistgooncustomerorsuppliercard, 'yesno', 0, '', $conf->entity); $res = dolibarr_set_const($db, "SOCIETE_ON_SEARCH_AND_LIST_GO_ON_CUSTOMER_OR_SUPPLIER_CARD", $setonsearchandlistgooncustomerorsuppliercard, 'yesno', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
if (!$error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');

View File

@ -59,7 +59,7 @@ if ($action == 'update' || $action == 'add')
$constnote = $_POST["constnote"][$key]; $constnote = $_POST["constnote"][$key];
$res = dolibarr_set_const($db, $constname, $constvalue, $type[$consttype], 0, $constnote, $conf->entity); $res = dolibarr_set_const($db, $constname, $constvalue, $type[$consttype], 0, $constnote, $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
} }
if (!$error) if (!$error)

View File

@ -532,6 +532,7 @@ if ($action == 'edit')
print '<span class="opacitymedium">'.$langs->trans("EMailsDesc")."</span><br>\n"; print '<span class="opacitymedium">'.$langs->trans("EMailsDesc")."</span><br>\n";
print "<br>\n"; print "<br>\n";
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>'; print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
@ -552,10 +553,12 @@ if ($action == 'edit')
} }
print '</table>'; print '</table>';
print '</div>';
if (empty($conf->global->MAIN_DISABLE_ALL_MAILS)) { if (empty($conf->global->MAIN_DISABLE_ALL_MAILS)) {
print '<br>'; print '<br>';
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("MAIN_MAIL_SENDMODE").'</td><td></td></tr>'; print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("MAIN_MAIL_SENDMODE").'</td><td></td></tr>';
@ -663,6 +666,7 @@ if ($action == 'edit')
} }
print '</table>'; print '</table>';
print '</div>';
if ($conf->global->MAIN_MAIL_SENDMODE == 'mail' && empty($conf->global->MAIN_HIDE_WARNING_TO_ENCOURAGE_SMTP_SETUP)) { if ($conf->global->MAIN_MAIL_SENDMODE == 'mail' && empty($conf->global->MAIN_HIDE_WARNING_TO_ENCOURAGE_SMTP_SETUP)) {
print info_admin($langs->trans("WarningPHPMail").'<br>'.$langs->trans("WarningPHPMailA").'<br>'.$langs->trans("WarningPHPMailB").'<br>'.$langs->trans("WarningPHPMailC").'<br><br>'.$langs->trans("WarningPHPMailD"), 0, 0, 'warning'); print info_admin($langs->trans("WarningPHPMail").'<br>'.$langs->trans("WarningPHPMailA").'<br>'.$langs->trans("WarningPHPMailB").'<br>'.$langs->trans("WarningPHPMailC").'<br><br>'.$langs->trans("WarningPHPMailD"), 0, 0, 'warning');
@ -670,13 +674,15 @@ if ($action == 'edit')
print '<br>'; print '<br>';
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("OtherOptions").'</td><td></td></tr>'; print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("OtherOptions").'</td><td></td></tr>';
// From // From
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_FROM", ini_get('sendmail_from') ?ini_get('sendmail_from') : $langs->transnoentities("Undefined")).'</td>'; print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_FROM", ini_get('sendmail_from') ?ini_get('sendmail_from') : $langs->transnoentities("Undefined")).'</td>';
print '<td>'.$conf->global->MAIN_MAIL_EMAIL_FROM; print '<td>'.$conf->global->MAIN_MAIL_EMAIL_FROM;
if (!empty($conf->global->MAIN_MAIL_EMAIL_FROM) && !isValidEmail($conf->global->MAIN_MAIL_EMAIL_FROM)) print img_warning($langs->trans("ErrorBadEMail")); if (empty($conf->global->MAIN_MAIL_EMAIL_FROM)) print img_warning($langs->trans("Mandatory"));
elseif (!isValidEmail($conf->global->MAIN_MAIL_EMAIL_FROM)) print img_warning($langs->trans("ErrorBadEMail"));
print '</td></tr>'; print '</td></tr>';
// Default from type // Default from type
@ -746,6 +752,7 @@ if ($action == 'edit')
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_ENABLED_USER_DEST_SELECT").'</td><td>'.yn($conf->global->MAIN_MAIL_ENABLED_USER_DEST_SELECT).'</td></tr>'; print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_ENABLED_USER_DEST_SELECT").'</td><td>'.yn($conf->global->MAIN_MAIL_ENABLED_USER_DEST_SELECT).'</td></tr>';
print '</table>'; print '</table>';
print '</div>';
} }
print dol_get_fiche_end(); print dol_get_fiche_end();
@ -761,7 +768,7 @@ if ($action == 'edit')
{ {
if (function_exists('fsockopen') && $port && $server) if (function_exists('fsockopen') && $port && $server)
{ {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=testconnect#formmailbeforetitle">'.$langs->trans("DoTestServerAvailability").'</a>'; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=testconnect&date='.dol_now().'#formmailaftertstconnect">'.$langs->trans("DoTestServerAvailability").'</a>';
} }
} else { } else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("FeatureNotAvailableOnLinux").'">'.$langs->trans("DoTestServerAvailability").'</a>'; print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("FeatureNotAvailableOnLinux").'">'.$langs->trans("DoTestServerAvailability").'</a>';
@ -837,6 +844,7 @@ if ($action == 'edit')
// Run the test to connect // Run the test to connect
if ($action == 'testconnect') if ($action == 'testconnect')
{ {
print '<div id="formmailaftertstconnect" name="formmailaftertstconnect"></div>';
print load_fiche_titre($langs->trans("DoTestServerAvailability")); print load_fiche_titre($langs->trans("DoTestServerAvailability"));
include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
@ -851,6 +859,7 @@ if ($action == 'edit')
} }
setEventMessages($errormsg, null, 'errors'); setEventMessages($errormsg, null, 'errors');
print $errormsg;
} }
print '<br>'; print '<br>';
} }

View File

@ -523,10 +523,10 @@ if ($mode == 'common' || $mode == 'commonkanban') {
$moreforfilter .= '<div class="colorbacktimesheet float valignmiddle">'; $moreforfilter .= '<div class="colorbacktimesheet float valignmiddle">';
$moreforfilter .= '<div class="divsearchfield paddingtop">'; $moreforfilter .= '<div class="divsearchfield paddingtop">';
$moreforfilter .= $langs->trans('Keyword').': <input type="text" id="search_keyword" name="search_keyword" class="maxwidth100" value="'.dol_escape_htmltag($search_keyword).'">'; $moreforfilter .= img_picto($langs->trans("Filter"), 'filter', 'class="paddingright opacitymedium"').'<input type="text" id="search_keyword" name="search_keyword" class="maxwidth100" value="'.dol_escape_htmltag($search_keyword).'" placeholder="'.dol_escape_htmltag($langs->trans('Keyword')).'">';
$moreforfilter .= '</div>'; $moreforfilter .= '</div>';
$moreforfilter .= '<div class="divsearchfield paddingtop">'; $moreforfilter .= '<div class="divsearchfield paddingtop">';
$moreforfilter .= $langs->trans('Origin').': '.$form->selectarray('search_nature', $arrayofnatures, dol_escape_htmltag($search_nature), 1, 0, 0, '', 0, 0, 0, '', 'maxwidth200', 1); $moreforfilter .= $form->selectarray('search_nature', $arrayofnatures, dol_escape_htmltag($search_nature), $langs->trans('Origin'), 0, 0, '', 0, 0, 0, '', 'maxwidth200', 1);
$moreforfilter .= '</div>'; $moreforfilter .= '</div>';
if (!empty($conf->global->MAIN_FEATURES_LEVEL)) { if (!empty($conf->global->MAIN_FEATURES_LEVEL)) {
$array_version = array('stable'=>$langs->transnoentitiesnoconv("Stable")); $array_version = array('stable'=>$langs->transnoentitiesnoconv("Stable"));
@ -540,11 +540,11 @@ if ($mode == 'common' || $mode == 'commonkanban') {
$array_version['development'] = $langs->trans("Development"); $array_version['development'] = $langs->trans("Development");
} }
$moreforfilter .= '<div class="divsearchfield paddingtop">'; $moreforfilter .= '<div class="divsearchfield paddingtop">';
$moreforfilter .= $langs->trans('Version').': '.$form->selectarray('search_version', $array_version, $search_version, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth150', 1); $moreforfilter .= $form->selectarray('search_version', $array_version, $search_version, $langs->trans('Version'), 0, 0, '', 0, 0, 0, '', 'maxwidth150', 1);
$moreforfilter .= '</div>'; $moreforfilter .= '</div>';
} }
$moreforfilter .= '<div class="divsearchfield paddingtop">'; $moreforfilter .= '<div class="divsearchfield paddingtop">';
$moreforfilter .= $langs->trans('Status').': '.$form->selectarray('search_status', array('active'=>$langs->transnoentitiesnoconv("Enabled"), 'disabled'=>$langs->transnoentitiesnoconv("Disabled")), $search_status, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth150', 1); $moreforfilter .= $form->selectarray('search_status', array('active'=>$langs->transnoentitiesnoconv("Enabled"), 'disabled'=>$langs->transnoentitiesnoconv("Disabled")), $search_status, $langs->trans('Status'), 0, 0, '', 0, 0, 0, '', 'maxwidth150', 1);
$moreforfilter .= '</div>'; $moreforfilter .= '</div>';
$moreforfilter .= ' '; $moreforfilter .= ' ';
$moreforfilter .= '<div class="divsearchfield">'; $moreforfilter .= '<div class="divsearchfield">';
@ -937,6 +937,8 @@ if ($mode == 'common' || $mode == 'commonkanban') {
if ($mode == 'marketplace') { if ($mode == 'marketplace') {
print dol_get_fiche_head($head, $mode, '', -1); print dol_get_fiche_head($head, $mode, '', -1);
print '<br>';
// Marketplace // Marketplace
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
print '<table summary="list_of_modules" class="noborder centpercent">'."\n"; print '<table summary="list_of_modules" class="noborder centpercent">'."\n";
@ -977,8 +979,8 @@ if ($mode == 'marketplace') {
?> ?>
<input type="hidden" name="token" value="<?php echo newToken(); ?>"> <input type="hidden" name="token" value="<?php echo newToken(); ?>">
<input type="hidden" name="mode" value="marketplace"> <input type="hidden" name="mode" value="marketplace">
<div class="divsearchfield"><?php echo $langs->trans('Keyword') ?>: <div class="divsearchfield">
<input name="search_keyword" placeholder="<?php echo $langs->trans('Chercher un module') ?>" id="search_keyword" type="text" size="50" value="<?php echo $options['search'] ?>"><br> <input name="search_keyword" placeholder="<?php echo $langs->trans('Keyword') ?>" id="search_keyword" type="text" size="50" value="<?php echo $options['search'] ?>"><br>
</div> </div>
<div class="divsearchfield"> <div class="divsearchfield">
<input class="button buttongen" value="<?php echo $langs->trans('Rechercher') ?>" type="submit"> <input class="button buttongen" value="<?php echo $langs->trans('Rechercher') ?>" type="submit">
@ -1190,6 +1192,8 @@ if ($mode == 'deploy') {
if ($mode == 'develop') { if ($mode == 'develop') {
print dol_get_fiche_head($head, $mode, '', -1); print dol_get_fiche_head($head, $mode, '', -1);
print '<br>';
// Marketplace // Marketplace
print "<table summary=\"list_of_modules\" class=\"noborder\" width=\"100%\">\n"; print "<table summary=\"list_of_modules\" class=\"noborder\" width=\"100%\">\n";
print "<tr class=\"liste_titre\">\n"; print "<tr class=\"liste_titre\">\n";

View File

@ -53,7 +53,7 @@ if ($action == 'updateMask')
if ($maskconstmrp) $res = dolibarr_set_const($db, $maskconstmrp, $maskmrp, 'chaine', 0, '', $conf->entity); if ($maskconstmrp) $res = dolibarr_set_const($db, $maskconstmrp, $maskmrp, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
if (!$error) if (!$error)
{ {
@ -142,7 +142,7 @@ elseif ($action == 'setdoc')
$draft = GETPOST("MRP_MO_DRAFT_WATERMARK"); $draft = GETPOST("MRP_MO_DRAFT_WATERMARK");
$res = dolibarr_set_const($db, "MRP_MO_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "MRP_MO_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
if (!$error) if (!$error)
{ {
@ -156,7 +156,7 @@ elseif ($action == 'setdoc')
$res = dolibarr_set_const($db, "MRP_MO_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "MRP_MO_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
if (!$error) if (!$error)
{ {

View File

@ -51,7 +51,7 @@ if ($action == 'updateMask')
$maskpayment = GETPOST('maskpayment', 'alpha'); $maskpayment = GETPOST('maskpayment', 'alpha');
if ($maskconstpayment) $res = dolibarr_set_const($db, $maskconstpayment, $maskpayment, 'chaine', 0, '', $conf->entity); if ($maskconstpayment) $res = dolibarr_set_const($db, $maskconstpayment, $maskpayment, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
if (!$error) if (!$error)
{ {
@ -70,10 +70,10 @@ if ($action == 'setparams')
{ {
$freetext = GETPOST('FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS', 'restricthtml'); // No alpha here, we want exact string $freetext = GETPOST('FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS', 'restricthtml'); // No alpha here, we want exact string
$res = dolibarr_set_const($db, "FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS", $freetext, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS", $freetext, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
$res = dolibarr_set_const($db, "PAYMENTS_REPORT_GROUP_BY_MOD", GETPOST('PAYMENTS_REPORT_GROUP_BY_MOD', 'int'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "PAYMENTS_REPORT_GROUP_BY_MOD", GETPOST('PAYMENTS_REPORT_GROUP_BY_MOD', 'int'), 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
if ($error) if ($error)
{ {

View File

@ -50,10 +50,9 @@ if ($action == "set")
$id = GETPOST('PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT', 'int'); $id = GETPOST('PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT', 'int');
$account = new Account($db); $account = new Account($db);
if ($account->fetch($id) > 0) if ($account->fetch($id) > 0) {
{
$res = dolibarr_set_const($db, "PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT", $id, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT", $id, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
/* /*
$res = dolibarr_set_const($db, "PRELEVEMENT_CODE_BANQUE", $account->code_banque,'chaine',0,'',$conf->entity); $res = dolibarr_set_const($db, "PRELEVEMENT_CODE_BANQUE", $account->code_banque,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++; if (! $res > 0) $error++;
@ -70,32 +69,35 @@ if ($action == "set")
$res = dolibarr_set_const($db, "PRELEVEMENT_RAISON_SOCIALE", $account->proprio,'chaine',0,'',$conf->entity); $res = dolibarr_set_const($db, "PRELEVEMENT_RAISON_SOCIALE", $account->proprio,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++; if (! $res > 0) $error++;
*/ */
} else $error++; } else {
$error++;
}
/* Moved to account /* Moved to account
$res = dolibarr_set_const($db, "PAYMENTBYBANKTRANSFER_ICS", GETPOST("PAYMENTBYBANKTRANSFER_ICS"), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "PAYMENTBYBANKTRANSFER_ICS", GETPOST("PAYMENTBYBANKTRANSFER_ICS"), 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
*/ */
if (GETPOST("PAYMENTBYBANKTRANSFER_USER") > 0) if (GETPOST("PAYMENTBYBANKTRANSFER_USER") > 0)
{ {
$res = dolibarr_set_const($db, "PAYMENTBYBANKTRANSFER_USER", GETPOST("PAYMENTBYBANKTRANSFER_USER"), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "PAYMENTBYBANKTRANSFER_USER", GETPOST("PAYMENTBYBANKTRANSFER_USER"), 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
} }
/* /*
if (GETPOST("PAYMENTBYBANKTRANSFER_END_TO_END") || GETPOST("PAYMENTBYBANKTRANSFER_END_TO_END") == "") if (GETPOST("PAYMENTBYBANKTRANSFER_END_TO_END") || GETPOST("PAYMENTBYBANKTRANSFER_END_TO_END") == "")
{ {
$res = dolibarr_set_const($db, "PAYMENTBYBANKTRANSFER_END_TO_END", GETPOST("PAYMENTBYBANKTRANSFER_END_TO_END"), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "PAYMENTBYBANKTRANSFER_END_TO_END", GETPOST("PAYMENTBYBANKTRANSFER_END_TO_END"), 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
} }
if (GETPOST("PAYMENTBYBANKTRANSFER_USTRD") || GETPOST("PAYMENTBYBANKTRANSFER_USTRD") == "") if (GETPOST("PAYMENTBYBANKTRANSFER_USTRD") || GETPOST("PAYMENTBYBANKTRANSFER_USTRD") == "")
{ {
$res = dolibarr_set_const($db, "PAYMENTBYBANKTRANSFER_USTRD", GETPOST("PAYMENTBYBANKTRANSFER_USTRD"), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "PAYMENTBYBANKTRANSFER_USTRD", GETPOST("PAYMENTBYBANKTRANSFER_USTRD"), 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
} }
*/ */
if (GETPOST("PAYMENTBYBANKTRANSFER_ADDDAYS") || GETPOST("PAYMENTBYBANKTRANSFER_ADDDAYS") == "") if (GETPOST("PAYMENTBYBANKTRANSFER_ADDDAYS") || GETPOST("PAYMENTBYBANKTRANSFER_ADDDAYS") == "")
{ {
$res = dolibarr_set_const($db, "PAYMENTBYBANKTRANSFER_ADDDAYS", GETPOST("PAYMENTBYBANKTRANSFER_ADDDAYS"), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "PAYMENTBYBANKTRANSFER_ADDDAYS", GETPOST("PAYMENTBYBANKTRANSFER_ADDDAYS"), 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
} elseif (!$error) } elseif (!$error)
{ {
$db->commit(); $db->commit();

View File

@ -55,7 +55,7 @@ if ($action == "set")
if ($account->fetch($id) > 0) if ($account->fetch($id) > 0)
{ {
$res = dolibarr_set_const($db, "PRELEVEMENT_ID_BANKACCOUNT", $id, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "PRELEVEMENT_ID_BANKACCOUNT", $id, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
/* /*
$res = dolibarr_set_const($db, "PRELEVEMENT_CODE_BANQUE", $account->code_banque,'chaine',0,'',$conf->entity); $res = dolibarr_set_const($db, "PRELEVEMENT_CODE_BANQUE", $account->code_banque,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++; if (! $res > 0) $error++;
@ -75,21 +75,20 @@ if ($action == "set")
} else $error++; } else $error++;
/* Moved to account /* Moved to account
$res = dolibarr_set_const($db, "PRELEVEMENT_ICS", GETPOST("PRELEVEMENT_ICS"), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "PRELEVEMENT_ICS", GETPOST("PRELEVEMENT_ICS"), 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
*/ */
if (GETPOST("PRELEVEMENT_USER") > 0) { if (GETPOST("PRELEVEMENT_USER") > 0) {
$res = dolibarr_set_const($db, "PRELEVEMENT_USER", GETPOST("PRELEVEMENT_USER"), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "PRELEVEMENT_USER", GETPOST("PRELEVEMENT_USER"), 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
} }
if (GETPOST("PRELEVEMENT_END_TO_END") || GETPOST("PRELEVEMENT_END_TO_END") == "") { if (GETPOST("PRELEVEMENT_END_TO_END") || GETPOST("PRELEVEMENT_END_TO_END") == "") {
$res = dolibarr_set_const($db, "PRELEVEMENT_END_TO_END", GETPOST("PRELEVEMENT_END_TO_END"), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "PRELEVEMENT_END_TO_END", GETPOST("PRELEVEMENT_END_TO_END"), 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
} }
if (GETPOST("PRELEVEMENT_USTRD") || GETPOST("PRELEVEMENT_USTRD") == "") { if (GETPOST("PRELEVEMENT_USTRD") || GETPOST("PRELEVEMENT_USTRD") == "") {
$res = dolibarr_set_const($db, "PRELEVEMENT_USTRD", GETPOST("PRELEVEMENT_USTRD"), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "PRELEVEMENT_USTRD", GETPOST("PRELEVEMENT_USTRD"), 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
} }
$res = dolibarr_set_const($db, "PRELEVEMENT_ADDDAYS", GETPOST("PRELEVEMENT_ADDDAYS"), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "PRELEVEMENT_ADDDAYS", GETPOST("PRELEVEMENT_ADDDAYS"), 'chaine', 0, '', $conf->entity);

View File

@ -57,7 +57,7 @@ if ($action == 'updateMask') {
$maskpropal = GETPOST('maskpropal', 'alpha'); $maskpropal = GETPOST('maskpropal', 'alpha');
if ($maskconstpropal) $res = dolibarr_set_const($db, $maskconstpropal, $maskpropal, 'chaine', 0, '', $conf->entity); if ($maskconstpropal) $res = dolibarr_set_const($db, $maskconstpropal, $maskpropal, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
if (!$error) if (!$error)
{ {
@ -109,7 +109,7 @@ if ($action == 'updateMask') {
$res = dolibarr_set_const($db, "FACTURE_RIB_NUMBER", $rib, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "FACTURE_RIB_NUMBER", $rib, 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "FACTURE_CHQ_NUMBER", $chq, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "FACTURE_CHQ_NUMBER", $chq, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
if (!$error) if (!$error)
{ {
@ -121,7 +121,7 @@ if ($action == 'updateMask') {
$draft = GETPOST('PROPALE_DRAFT_WATERMARK', 'alpha'); $draft = GETPOST('PROPALE_DRAFT_WATERMARK', 'alpha');
$res = dolibarr_set_const($db, "PROPALE_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "PROPALE_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
if (!$error) if (!$error)
{ {
@ -134,7 +134,7 @@ if ($action == 'updateMask') {
$res = dolibarr_set_const($db, "PROPOSAL_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "PROPOSAL_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
if (!$error) if (!$error)
{ {
@ -145,7 +145,7 @@ if ($action == 'updateMask') {
} elseif ($action == 'setdefaultduration') { } elseif ($action == 'setdefaultduration') {
$res = dolibarr_set_const($db, "PROPALE_VALIDITY_DURATION", $value, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "PROPALE_VALIDITY_DURATION", $value, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
if (!$error) if (!$error)
{ {
@ -156,7 +156,7 @@ if ($action == 'updateMask') {
} elseif ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL') { } elseif ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL') {
$res = dolibarr_set_const($db, "BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL", $value, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL", $value, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
if (!$error) { if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');

View File

@ -443,7 +443,6 @@ if ($mode == 'template' && $user->admin) {
print '<td><input size="50" type="text" name="templatename" value="'.$printer->listprinterstemplates[$line]['name'].'"></td>'; print '<td><input size="50" type="text" name="templatename" value="'.$printer->listprinterstemplates[$line]['name'].'"></td>';
print '<td>'; print '<td>';
print '<textarea name="template" wrap="soft" cols="120" rows="12">'; print '<textarea name="template" wrap="soft" cols="120" rows="12">';
print GETPOSTISSET('template') ? GETPOST('template', 'alpha') : $printer->listprinterstemplates[$line]['template'];
print '</textarea>'; print '</textarea>';
print '</td>'; print '</td>';
print '<td></td>'; print '<td></td>';

View File

@ -67,7 +67,7 @@ if ($action == 'update' || $action == 'add')
$res = dolibarr_set_const($db, $constname, $constvalue, $type[$consttype], 0, $constnote, $conf->entity); $res = dolibarr_set_const($db, $constname, $constvalue, $type[$consttype], 0, $constnote, $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
} }
if (!$error) if (!$error)

View File

@ -96,7 +96,7 @@ if ($action == 'warehouse')
if ($value == -1 || empty($value) && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE)) { if ($value == -1 || empty($value) && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE)) {
$res = dolibarr_del_const($db, "MAIN_DEFAULT_WAREHOUSE", $conf->entity); $res = dolibarr_del_const($db, "MAIN_DEFAULT_WAREHOUSE", $conf->entity);
} }
if (!$res > 0) $error++; if (!($res > 0)) $error++;
} }
if ($action == 'specimen') if ($action == 'specimen')

View File

@ -65,7 +65,7 @@ if ($action == 'updateMask')
if ($maskconstinvoice) $res = dolibarr_set_const($db, $maskconstinvoice, $maskinvoice, 'chaine', 0, '', $conf->entity); if ($maskconstinvoice) $res = dolibarr_set_const($db, $maskconstinvoice, $maskinvoice, 'chaine', 0, '', $conf->entity);
if ($maskconstcredit) $res = dolibarr_set_const($db, $maskconstcredit, $maskcredit, 'chaine', 0, '', $conf->entity); if ($maskconstcredit) $res = dolibarr_set_const($db, $maskconstcredit, $maskcredit, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
if (!$error) if (!$error)
{ {
@ -170,7 +170,7 @@ if ($action == 'set_SUPPLIER_INVOICE_FREE_TEXT')
$res = dolibarr_set_const($db, "SUPPLIER_INVOICE_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "SUPPLIER_INVOICE_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
if (!$error) if (!$error)
{ {

View File

@ -63,7 +63,7 @@ if ($action == 'updateMask')
if ($maskconstorder) $res = dolibarr_set_const($db, $maskconstorder, $maskvalue, 'chaine', 0, '', $conf->entity); if ($maskconstorder) $res = dolibarr_set_const($db, $maskconstorder, $maskvalue, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
if (!$error) if (!$error)
{ {
@ -194,7 +194,7 @@ elseif ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_ORDER')
{ {
$res = dolibarr_set_const($db, "BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_ORDER", $value, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_ORDER", $value, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
if (!$error) if (!$error)
{ {

View File

@ -52,7 +52,7 @@ if ($action == 'updateMask')
$masksupplierpayment = GETPOST('masksupplierpayment', 'alpha'); $masksupplierpayment = GETPOST('masksupplierpayment', 'alpha');
if ($maskconstsupplierpayment) $res = dolibarr_set_const($db, $maskconstsupplierpayment, $masksupplierpayment, 'chaine', 0, '', $conf->entity); if ($maskconstsupplierpayment) $res = dolibarr_set_const($db, $maskconstsupplierpayment, $masksupplierpayment, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
if (!$error) if (!$error)
{ {
@ -136,7 +136,7 @@ elseif ($action == 'setdoc')
} elseif ($action == 'setparams') } elseif ($action == 'setparams')
{ {
$res = dolibarr_set_const($db, "PAYMENTS_FOURN_REPORT_GROUP_BY_MOD", GETPOST('PAYMENTS_FOURN_REPORT_GROUP_BY_MOD', 'int'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "PAYMENTS_FOURN_REPORT_GROUP_BY_MOD", GETPOST('PAYMENTS_FOURN_REPORT_GROUP_BY_MOD', 'int'), 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
if ($error) if ($error)
{ {

View File

@ -55,7 +55,7 @@ if ($action == 'updateMask')
$masksupplier_proposal = GETPOST('masksupplier_proposal', 'alpha'); $masksupplier_proposal = GETPOST('masksupplier_proposal', 'alpha');
if ($maskconstsupplier_proposal) $res = dolibarr_set_const($db, $maskconstsupplier_proposal, $masksupplier_proposal, 'chaine', 0, '', $conf->entity); if ($maskconstsupplier_proposal) $res = dolibarr_set_const($db, $maskconstsupplier_proposal, $masksupplier_proposal, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
if (!$error) if (!$error)
{ {
@ -111,7 +111,7 @@ if ($action == 'set_SUPPLIER_PROPOSAL_DRAFT_WATERMARK')
$draft = GETPOST('SUPPLIER_PROPOSAL_DRAFT_WATERMARK', 'alpha'); $draft = GETPOST('SUPPLIER_PROPOSAL_DRAFT_WATERMARK', 'alpha');
$res = dolibarr_set_const($db, "SUPPLIER_PROPOSAL_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "SUPPLIER_PROPOSAL_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
if (!$error) if (!$error)
{ {
@ -127,7 +127,7 @@ if ($action == 'set_SUPPLIER_PROPOSAL_FREE_TEXT')
$res = dolibarr_set_const($db, "SUPPLIER_PROPOSAL_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "SUPPLIER_PROPOSAL_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
if (!$error) if (!$error)
{ {
@ -141,7 +141,7 @@ if ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL')
{ {
$res = dolibarr_set_const($db, "BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL", $value, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL", $value, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
if (!$error) if (!$error)
{ {

View File

@ -138,7 +138,7 @@ if ($action == 'setlevel')
$res = dolibarr_set_const($db, "SYSLOG_LEVEL", $level, 'chaine', 0, '', 0); $res = dolibarr_set_const($db, "SYSLOG_LEVEL", $level, 'chaine', 0, '', 0);
dol_syslog("admin/syslog: level ".$level); dol_syslog("admin/syslog: level ".$level);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
if (!$error) if (!$error)
{ {
@ -146,7 +146,7 @@ if ($action == 'setlevel')
$res = dolibarr_set_const($db, "SYSLOG_FILE_SAVES", $file_saves, 'chaine', 0, '', 0); $res = dolibarr_set_const($db, "SYSLOG_FILE_SAVES", $file_saves, 'chaine', 0, '', 0);
dol_syslog("admin/syslog: file saves ".$file_saves); dol_syslog("admin/syslog: file saves ".$file_saves);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
} }
if (!$error) if (!$error)

View File

@ -73,7 +73,7 @@ print load_fiche_titre($title, '', 'title_setup');
// Version // Version
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Version").'</td><td>'.$langs->trans("Value").'</td></tr>'."\n"; print '<tr class="liste_titre"><td class="titlefieldcreate">'.$langs->trans("Version").'</td><td>'.$langs->trans("Value").'</td></tr>'."\n";
print '<tr class="oddeven"><td>'.$langs->trans("CurrentVersion").' ('.$langs->trans("Programs").')</td><td>'.DOL_VERSION; print '<tr class="oddeven"><td>'.$langs->trans("CurrentVersion").' ('.$langs->trans("Programs").')</td><td>'.DOL_VERSION;
// If current version differs from last upgrade // If current version differs from last upgrade
if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE)) if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE))
@ -139,7 +139,7 @@ print '<br>';
// Session // Session
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Session").'</td><td colspan="2">'.$langs->trans("Value").'</td></tr>'."\n"; print '<tr class="liste_titre"><td class="titlefieldcreate">'.$langs->trans("Session").'</td><td colspan="2">'.$langs->trans("Value").'</td></tr>'."\n";
print '<tr class="oddeven"><td>'.$langs->trans("SessionSavePath").'</td><td colspan="2">'.session_save_path().'</td></tr>'."\n"; print '<tr class="oddeven"><td>'.$langs->trans("SessionSavePath").'</td><td colspan="2">'.session_save_path().'</td></tr>'."\n";
print '<tr class="oddeven"><td>'.$langs->trans("SessionName").'</td><td colspan="2">'.session_name().'</td></tr>'."\n"; print '<tr class="oddeven"><td>'.$langs->trans("SessionName").'</td><td colspan="2">'.session_name().'</td></tr>'."\n";
print '<tr class="oddeven"><td>'.$langs->trans("SessionId").'</td><td colspan="2">'.session_id().'</td></tr>'."\n"; print '<tr class="oddeven"><td>'.$langs->trans("SessionId").'</td><td colspan="2">'.session_id().'</td></tr>'."\n";
@ -180,7 +180,7 @@ if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_S
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td class="titlefield">'.$langs->trans("LanguageFilesCachedIntoShmopSharedMemory").'</td>'; print '<td class="titlefieldcreate">'.$langs->trans("LanguageFilesCachedIntoShmopSharedMemory").'</td>';
print '<td>'.$langs->trans("NbOfEntries").'</td>'; print '<td>'.$langs->trans("NbOfEntries").'</td>';
print '<td class="right">'.$langs->trans("Address").'</td>'; print '<td class="right">'.$langs->trans("Address").'</td>';
print '</tr>'."\n"; print '</tr>'."\n";
@ -202,7 +202,7 @@ if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_S
// Localisation // Localisation
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("LocalisationDolibarrParameters").'</td><td>'.$langs->trans("Value").'</td></tr>'."\n"; print '<tr class="liste_titre"><td class="titlefieldcreate">'.$langs->trans("LocalisationDolibarrParameters").'</td><td>'.$langs->trans("Value").'</td></tr>'."\n";
print '<tr class="oddeven"><td>'.$langs->trans("LanguageBrowserParameter", "HTTP_ACCEPT_LANGUAGE").'</td><td>'.$_SERVER["HTTP_ACCEPT_LANGUAGE"].'</td></tr>'."\n"; print '<tr class="oddeven"><td>'.$langs->trans("LanguageBrowserParameter", "HTTP_ACCEPT_LANGUAGE").'</td><td>'.$_SERVER["HTTP_ACCEPT_LANGUAGE"].'</td></tr>'."\n";
print '<tr class="oddeven"><td>'.$langs->trans("CurrentUserLanguage").'</td><td>'.$langs->getDefaultLang().'</td></tr>'."\n"; print '<tr class="oddeven"><td>'.$langs->trans("CurrentUserLanguage").'</td><td>'.$langs->getDefaultLang().'</td></tr>'."\n";
// Thousands // Thousands
@ -222,7 +222,22 @@ if (($thousand != ',' && $thousand != '.') || ($thousand != ' '))
print "</tr>\n"; print "</tr>\n";
} }
print '<tr class="oddeven"><td>&nbsp; => price(1234.56)</td><td>'.price(1234.56).'</td></tr>'."\n"; print '<tr class="oddeven"><td>&nbsp; => price(1234.56)</td><td>'.price(1234.56).'</td></tr>'."\n";
// Timezone
// Timezones
// Database timezone
if ($conf->db->type == 'mysql' || $conf->db->type == 'mysqli')
{
print '<tr class="oddeven"><td>'.$langs->trans("MySQLTimeZone").' (database)</td><td>'; // Timezone server base
$sql = "SHOW VARIABLES where variable_name = 'system_time_zone'";
$resql = $db->query($sql);
if ($resql)
{
$obj = $db->fetch_object($resql);
print $form->textwithtooltip($obj->Value, $langs->trans('TZHasNoEffect'), 2, 1, img_info(''));
}
print '</td></tr>'."\n";
}
$txt = $langs->trans("OSTZ").' (variable system TZ): '.(!empty($_ENV["TZ"]) ? $_ENV["TZ"] : $langs->trans("NotDefined")).'<br>'."\n"; $txt = $langs->trans("OSTZ").' (variable system TZ): '.(!empty($_ENV["TZ"]) ? $_ENV["TZ"] : $langs->trans("NotDefined")).'<br>'."\n";
$txt .= $langs->trans("PHPTZ").' (date_default_timezone_get() / php.ini date.timezone): '.(getServerTimeZoneString()." / ".(ini_get("date.timezone") ? ini_get("date.timezone") : $langs->trans("NotDefined")))."<br>\n"; // date.timezone must be in valued defined in http://fr3.php.net/manual/en/timezones.europe.php $txt .= $langs->trans("PHPTZ").' (date_default_timezone_get() / php.ini date.timezone): '.(getServerTimeZoneString()." / ".(ini_get("date.timezone") ? ini_get("date.timezone") : $langs->trans("NotDefined")))."<br>\n"; // date.timezone must be in valued defined in http://fr3.php.net/manual/en/timezones.europe.php
$txt .= $langs->trans("Dolibarr constant MAIN_SERVER_TZ").': '.(empty($conf->global->MAIN_SERVER_TZ) ? $langs->trans("NotDefined") : $conf->global->MAIN_SERVER_TZ); $txt .= $langs->trans("Dolibarr constant MAIN_SERVER_TZ").': '.(empty($conf->global->MAIN_SERVER_TZ) ? $langs->trans("NotDefined") : $conf->global->MAIN_SERVER_TZ);
@ -238,23 +253,10 @@ $val .= ' &nbsp; &nbsp; &nbsp; '.getServerTimeZoneString();
$val .= ' &nbsp; &nbsp; &nbsp; '.$langs->trans("DaylingSavingTime").': '.($daylight === 'unknown' ? 'unknown' : ($a == $c ?yn($daylight) : yn(0).($daylight ? ' &nbsp; &nbsp; ('.$langs->trans('YesInSummer').')' : ''))); $val .= ' &nbsp; &nbsp; &nbsp; '.$langs->trans("DaylingSavingTime").': '.($daylight === 'unknown' ? 'unknown' : ($a == $c ?yn($daylight) : yn(0).($daylight ? ' &nbsp; &nbsp; ('.$langs->trans('YesInSummer').')' : '')));
print $form->textwithtooltip($val, $txt, 2, 1, img_info('')); print $form->textwithtooltip($val, $txt, 2, 1, img_info(''));
print '</td></tr>'."\n"; // value defined in http://fr3.php.net/manual/en/timezones.europe.php print '</td></tr>'."\n"; // value defined in http://fr3.php.net/manual/en/timezones.europe.php
print '<tr class="oddeven"><td>&nbsp; => '.$langs->trans("CurrentHour").'</td><td>'.dol_print_date(dol_now(), 'dayhour', 'tzserver').'</td></tr>'."\n"; print '<tr class="oddeven"><td>&nbsp; => '.$langs->trans("CurrentHour").'</td><td>'.dol_print_date(dol_now('gmt'), 'dayhour', 'tzserver').'</td></tr>'."\n";
print '<tr class="oddeven"><td>&nbsp; => dol_print_date(0,"dayhourtext")</td><td>'.dol_print_date(0, "dayhourtext").'</td>'; print '<tr class="oddeven"><td>&nbsp; => dol_print_date(0,"dayhourtext")</td><td>'.dol_print_date(0, "dayhourtext").'</td>';
print '<tr class="oddeven"><td>&nbsp; => dol_get_first_day(1970,1,false)</td><td>'.dol_get_first_day(1970, 1, false).' &nbsp; &nbsp; (=> dol_print_date() or idate() of this value = '.dol_print_date(dol_get_first_day(1970, 1, false), 'dayhour').')</td>'; print '<tr class="oddeven"><td>&nbsp; => dol_get_first_day(1970,1,false)</td><td>'.dol_get_first_day(1970, 1, false).' &nbsp; &nbsp; (=> dol_print_date() or idate() of this value = '.dol_print_date(dol_get_first_day(1970, 1, false), 'dayhour').')</td>';
print '<tr class="oddeven"><td>&nbsp; => dol_get_first_day(1970,1,true)</td><td>'.dol_get_first_day(1970, 1, true).' &nbsp; &nbsp; (=> dol_print_date() or idate() of this value = '.dol_print_date(dol_get_first_day(1970, 1, true), 'dayhour').')</td>'; print '<tr class="oddeven"><td>&nbsp; => dol_get_first_day(1970,1,true)</td><td>'.dol_get_first_day(1970, 1, true).' &nbsp; &nbsp; (=> dol_print_date() or idate() of this value = '.dol_print_date(dol_get_first_day(1970, 1, true), 'dayhour').')</td>';
// Database timezone
if ($conf->db->type == 'mysql' || $conf->db->type == 'mysqli')
{
print '<tr class="oddeven"><td>'.$langs->trans("MySQLTimeZone").' (database)</td><td>'; // Timezone server base
$sql = "SHOW VARIABLES where variable_name = 'system_time_zone'";
$resql = $db->query($sql);
if ($resql)
{
$obj = $db->fetch_object($resql);
print $form->textwithtooltip($obj->Value, $langs->trans('TZHasNoEffect'), 2, 1, img_info(''));
}
print '</td></tr>'."\n";
}
// Client // Client
$tz = (int) $_SESSION['dol_tz'] + (int) $_SESSION['dol_dst']; $tz = (int) $_SESSION['dol_tz'] + (int) $_SESSION['dol_dst'];
print '<tr class="oddeven"><td>'.$langs->trans("ClientTZ").'</td><td>'.($tz ? ($tz >= 0 ? '+' : '').$tz : '').' ('.($tz >= 0 ? '+' : '').($tz * 60 * 60).')'; print '<tr class="oddeven"><td>'.$langs->trans("ClientTZ").'</td><td>'.($tz ? ($tz >= 0 ? '+' : '').$tz : '').' ('.($tz >= 0 ? '+' : '').($tz * 60 * 60).')';
@ -265,7 +267,7 @@ else print yn(0);
if (!empty($_SESSION['dol_dst_first'])) print ' &nbsp; &nbsp; ('.dol_print_date(dol_stringtotime($_SESSION['dol_dst_first']), 'dayhour', 'gmt').' - '.dol_print_date(dol_stringtotime($_SESSION['dol_dst_second']), 'dayhour', 'gmt').')'; if (!empty($_SESSION['dol_dst_first'])) print ' &nbsp; &nbsp; ('.dol_print_date(dol_stringtotime($_SESSION['dol_dst_first']), 'dayhour', 'gmt').' - '.dol_print_date(dol_stringtotime($_SESSION['dol_dst_second']), 'dayhour', 'gmt').')';
print '</td></tr>'."\n"; print '</td></tr>'."\n";
print '</td></tr>'."\n"; print '</td></tr>'."\n";
print '<tr class="oddeven"><td>&nbsp; => '.$langs->trans("ClientHour").'</td><td>'.dol_print_date(dol_now(), 'dayhour', 'tzuser').'</td></tr>'."\n"; print '<tr class="oddeven"><td>&nbsp; => '.$langs->trans("ClientHour").'</td><td>'.dol_print_date(dol_now('gmt'), 'dayhour', 'tzuser').'</td></tr>'."\n";
$filesystemencoding = ini_get("unicode.filesystem_encoding"); // Disponible avec PHP 6.0 $filesystemencoding = ini_get("unicode.filesystem_encoding"); // Disponible avec PHP 6.0
print '<tr class="oddeven"><td>'.$langs->trans("File encoding").' (php.ini unicode.filesystem_encoding)</td><td>'.$filesystemencoding.'</td></tr>'."\n"; print '<tr class="oddeven"><td>'.$langs->trans("File encoding").' (php.ini unicode.filesystem_encoding)</td><td>'.$filesystemencoding.'</td></tr>'."\n";
@ -340,7 +342,7 @@ $configfileparameters = array(
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td class="titlefield">'.$langs->trans("Parameters").' '; print '<td class="titlefieldcreate">'.$langs->trans("Parameters").' ';
print $langs->trans("ConfigurationFile").' ('.$conffiletoshowshort.')'; print $langs->trans("ConfigurationFile").' ('.$conffiletoshowshort.')';
print '</td>'; print '</td>';
print '<td>'.$langs->trans("Parameter").'</td>'; print '<td>'.$langs->trans("Parameter").'</td>';

View File

@ -93,13 +93,13 @@ if ($maxphp > 0 && $maxphp2 > 0 && $maxphp > $maxphp2)
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>'; print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
$ErrorPicturePath = "../../theme/eldy/img/error.png"; $ErrorPicturePath = "../../theme/eldy/img/error.png";
$WarningPicturePath = "../../theme/eldy/img/warning.png"; $WarningPicturePath = "../../theme/eldy/img/warning.png";
$OkayPicturePath = "../../theme/eldy/img/tick.png"; $OkayPicturePath = "../../theme/eldy/img/tick.png";
print '<tr><td width="220">'.$langs->trans("Version").'</td><td>'; print '<tr><td>'.$langs->trans("Version").'</td><td>';
$arrayphpminversionerror = array(5, 5, 0); $arrayphpminversionerror = array(5, 5, 0);
$arrayphpminversionwarning = array(5, 6, 0); $arrayphpminversionwarning = array(5, 6, 0);
@ -153,11 +153,8 @@ $loadedExtensions = array_map('strtolower', get_loaded_extensions(false));
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td width="200">'.$langs->trans("Extension").'</td>'; print '<td class="titlefield">'.$langs->trans("Extension").'</td>';
//print '<td align="center">'.$langs->trans("EnabledInSetup").'</td>'; print '<td>'.$langs->trans("Test").'</td>';
print '<td align="center">'.$langs->trans("Loaded").'</td>';
print '<td align="center">'.$langs->trans("FunctionTest").'</td>';
print '<td>'.$langs->trans("Result").'</td>';
print '</tr>'; print '</tr>';
$functions = ["mb_check_encoding"]; $functions = ["mb_check_encoding"];
@ -165,9 +162,6 @@ $name = "MBString";
print "<tr>"; print "<tr>";
print "<td>".$name."</td>"; print "<td>".$name."</td>";
//print getTableColumn($name, $activatedExtensions);
print getTableColumn($name, $loadedExtensions);
print getTableColumnFunction($functions);
print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions); print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions);
print "</tr>"; print "</tr>";
@ -176,9 +170,6 @@ $name = "JSON";
print "<tr>"; print "<tr>";
print "<td>".$name."</td>"; print "<td>".$name."</td>";
//print getTableColumn($name, $activatedExtensions);
print getTableColumn($name, $loadedExtensions);
print getTableColumnFunction($functions);
print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions); print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions);
print "</tr>"; print "</tr>";
@ -187,8 +178,6 @@ $name = "GD";
print "<tr>"; print "<tr>";
print "<td>".$name."</td>"; print "<td>".$name."</td>";
print getTableColumn($name, $loadedExtensions);
print getTableColumnFunction($functions);
print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions); print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions);
print "</tr>"; print "</tr>";
@ -197,8 +186,6 @@ $name = "Curl";
print "<tr>"; print "<tr>";
print "<td>".$name."</td>"; print "<td>".$name."</td>";
print getTableColumn($name, $loadedExtensions);
print getTableColumnFunction($functions);
print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions); print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions);
print "</tr>"; print "</tr>";
@ -209,8 +196,6 @@ if (empty($_SERVER["SERVER_ADMIN"]) || $_SERVER["SERVER_ADMIN"] != 'doliwamp@loc
print "<tr>"; print "<tr>";
print "<td>".$name."</td>"; print "<td>".$name."</td>";
print getTableColumn($name, $loadedExtensions);
print getTableColumnFunction($functions);
print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions); print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions);
print "</tr>"; print "</tr>";
} }
@ -220,8 +205,6 @@ $name = "IMAP";
print "<tr>"; print "<tr>";
print "<td>".$name."</td>"; print "<td>".$name."</td>";
print getTableColumn($name, $loadedExtensions);
print getTableColumnFunction($functions);
print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions); print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions);
print "</tr>"; print "</tr>";
@ -230,8 +213,6 @@ $name = "xDebug";
print "<tr>"; print "<tr>";
print "<td>".$name."</td>"; print "<td>".$name."</td>";
print getTableColumn($name, $loadedExtensions);
print getTableColumnFunction($functions);
print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions); print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions);
print "</tr>"; print "</tr>";
@ -246,7 +227,7 @@ foreach ($phparray as $key => $value)
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
print '<table class="noborder">'; print '<table class="noborder">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td width="220px">'.$key.'</td>'; print '<td class="titlefield">'.$key.'</td>';
print '<td colspan="2">'.$langs->trans("Value").'</td>'; print '<td colspan="2">'.$langs->trans("Value").'</td>';
print "</tr>\n"; print "</tr>\n";
@ -293,69 +274,6 @@ llxFooter();
$db->close(); $db->close();
/**
* Return a table column with a indicator (okay or warning), based on the given name and list
*
* @param string $name The name to check inside the given list
* @param array $list A list that should contains the given name
*
* @return string
*/
function getTableColumn($name, array $list)
{
global $langs;
$name = strtolower($name);
$html = "<td align='center'>";
if (in_array($name, $list))
{
if ($name == 'xdebug') $html .= '<img src="../../theme/eldy/img/warning.png" title="'.$langs->trans("ModuleActivated", "xdebug").'">';
else $html .= '<img src="../../theme/eldy/img/tick.png" title="Ok">';
} else {
if ($name == 'xdebug') $html .= yn(0);
else $html .= '<img src="../../theme/eldy/img/warning.png" title="Warning">';
}
$html .= "</td>";
return $html;
}
/**
* Return a table column with a indicator (okay or warning), based on the given functions to check
*
* @param array $functions A list with functions to check
*
* @return string
*/
function getTableColumnFunction(array $functions)
{
if (count($functions) < 1)
{
return "<td align='center'>-</td>";
}
$result = true;
$html = "<td align='center'>";
foreach ($functions as $function)
{
$result = $result && function_exists($function);
}
if ($result)
{
$html .= '<img src="../../theme/eldy/img/tick.png" alt="Ok">';
} else {
$html .= '<img src="../../theme/eldy/img/warning.png" alt="Warning">';
}
$html .= "</td>";
return $html;
}
/** /**
* Return a result column with a translated result text * Return a result column with a translated result text
* *
@ -363,7 +281,6 @@ function getTableColumnFunction(array $functions)
* @param array $activated A list with all activated PHP extensions. Deprecated. * @param array $activated A list with all activated PHP extensions. Deprecated.
* @param array $loaded A list with all loaded PHP extensions * @param array $loaded A list with all loaded PHP extensions
* @param array $functions A list with all PHP functions to check * @param array $functions A list with all PHP functions to check
*
* @return string * @return string
*/ */
function getResultColumn($name, array $activated, array $loaded, array $functions) function getResultColumn($name, array $activated, array $loaded, array $functions)
@ -371,6 +288,7 @@ function getResultColumn($name, array $activated, array $loaded, array $function
global $langs; global $langs;
$result = true; $result = true;
//$result = $result && in_array(strtolower($name), $activated); //$result = $result && in_array(strtolower($name), $activated);
$result = $result && in_array(strtolower($name), $loaded); $result = $result && in_array(strtolower($name), $loaded);
@ -380,7 +298,29 @@ function getResultColumn($name, array $activated, array $loaded, array $function
} }
$html = "<td>"; $html = "<td>";
$html .= $result ? $langs->trans("PHPSupport", $name) : $langs->trans("ErrorPHPDoesNotSupport", $name); if ($result) {
if (strtolower($name) == 'xdebug') $html .= img_warning($langs->trans("ModuleActivated", "xdebug"));
else $html .= img_picto($langs->trans("Ok"), 'tick');
if (in_array(strtolower($name), $loaded)) {
$html .= ' '.$langs->trans("Loaded").' - ';
} else {
//$html .= ' '.$langs->trans("NotLoaded").' - ';
}
if (strtolower($name) == 'xdebug') {
$html .= ' '.$langs->trans("ModuleActivated", "xdebug");
} else {
$html .= ' '.$langs->trans("PHPSupport", $name);
}
} else {
if (strtolower($name) == 'xdebug') $html .= yn(0).' - ';
else $html .= img_warning($langs->trans("ModuleActivated", "xdebug"));
if (in_array(strtolower($name), $loaded)) {
$html .= ' '.$langs->trans("Loaded").' - ';
} else {
//$html .= ' '.$langs->trans("NotLoaded").' - ';
}
$html .= ' '.$langs->trans("ErrorPHPDoesNotSupport", $name);
}
$html .= "</td>"; $html .= "</td>";
return $html; return $html;

View File

@ -43,9 +43,6 @@ if (GETPOST('action', 'aZ09') == 'donothing')
* View * View
*/ */
$form = new Form($db);
$nowstring = dol_print_date(dol_now(), 'dayhourlog');
llxHeader(); llxHeader();
print load_fiche_titre($langs->trans("Security"), '', 'title_setup'); print load_fiche_titre($langs->trans("Security"), '', 'title_setup');
@ -78,7 +75,7 @@ else {
print '<br>'; print '<br>';
print '<br>'; print '<br>';
print load_fiche_titre($langs->trans("ConfigFile"), '', 'folder'); print load_fiche_titre($langs->trans("ConfigurationFile"), '', 'folder');
print '<strong>'.$langs->trans("dolibarr_main_prod").'</strong>: '.$dolibarr_main_prod; print '<strong>'.$langs->trans("dolibarr_main_prod").'</strong>: '.$dolibarr_main_prod;
if (empty($dolibarr_main_prod)) { if (empty($dolibarr_main_prod)) {
@ -90,7 +87,12 @@ print '<strong>'.$langs->trans("dolibarr_nocsrfcheck").'</strong>: '.$dolibarr_n
if (!empty($dolibarr_nocsrfcheck)) { if (!empty($dolibarr_nocsrfcheck)) {
print img_picto('', 'warning').' &nbsp; '.$langs->trans("IfYouAreOnAProductionSetThis", 0); print img_picto('', 'warning').' &nbsp; '.$langs->trans("IfYouAreOnAProductionSetThis", 0);
} }
print '<br>';
print '<strong>'.$langs->trans("dolibarr_main_restrict_ip").'</strong>: '.$dolibarr_main_restrict_ip;
/*if (empty($dolibarr_main_restrict_ip)) {
print ' &nbsp; '.img_picto('', 'warning').' '.$langs->trans("IfYouAreOnAProductionSetThis", 1);
}*/
print '<br>'; print '<br>';
print '<br>'; print '<br>';
@ -102,9 +104,17 @@ print '<strong>'.$langs->trans("PermissionsOnFilesInWebRoot").'</strong>: ';
print 'TODO'; print 'TODO';
print '<br>'; print '<br>';
print '<strong>'.$langs->trans("PermissionsOnFile", 'conf.php').'</strong>: '; print '<strong>'.$langs->trans("PermissionsOnFile", $conffile).'</strong>: '; // $conffile is defined into filefunc.inc.php
// TODO Check permission on file conf.php (read only for the web user) $perms = fileperms($dolibarr_main_document_root.'/'.$conffile);
print 'TODO'; if ($perms) {
if (($perms & 0x0004) || ($perms & 0x0002)) {
print img_warning().' '.$langs->trans("ConfFileIsReadableOrWritableByAnyUsers");
} else {
print img_picto('', 'tick');
}
} else {
print img_warning().' '.$langs->trans("FailedToReadFile", $conffile);
}
print '<br>'; print '<br>';
print '<br>'; print '<br>';
@ -137,14 +147,15 @@ print '<br>';
print load_fiche_titre($langs->trans("Menu").' '.$langs->trans("SecuritySetup"), '', 'folder'); print load_fiche_titre($langs->trans("Menu").' '.$langs->trans("SecuritySetup"), '', 'folder');
//print '<strong>'.$langs->trans("PasswordEncryption").'</strong>: '; //print '<strong>'.$langs->trans("PasswordEncryption").'</strong>: ';
print '<strong>MAIN_SECURITY_HASH_ALGO</strong> = '.(empty($conf->global->MAIN_SECURITY_HASH_ALGO) ? 'unset' : '')." &nbsp; "; print '<strong>MAIN_SECURITY_HASH_ALGO</strong> = '.(empty($conf->global->MAIN_SECURITY_HASH_ALGO) ? $langs->trans("Undefined") : '')." &nbsp; ";
print '<span class="opacitymedium"> &nbsp; If unset: \'md5\'</span> '; print '<span class="opacitymedium"> &nbsp; If unset: \'md5\'</span> ';
print '<span class="opacitymedium"> - Recommanded value: \'password_hash\'</span><br>'; print '<span class="opacitymedium"> - Recommanded value: \'password_hash\'</span><br>';
print '<strong>MAIN_SECURITY_SALT</strong> = '.$conf->global->MAIN_SECURITY_SALT.'<br>'; print '<strong>MAIN_SECURITY_SALT</strong> = '.(empty($conf->global->MAIN_SECURITY_SALT) ? $langs->trans("Undefined") : '').'<br>';
print '<br>'; print '<br>';
// TODO // TODO
print '<strong>'.$langs->trans("AntivirusEnabledOnUpload").'</strong>: '; print '<strong>'.$langs->trans("AntivirusEnabledOnUpload").'</strong>: ';
print empty($conf->global->MAIN_ANTIVIRUS_COMMAND) ? '' : img_picto('', 'tick').' ';
print yn($conf->global->MAIN_ANTIVIRUS_COMMAND ? 1 : 0); print yn($conf->global->MAIN_ANTIVIRUS_COMMAND ? 1 : 0);
if (!empty($conf->global->MAIN_ANTIVIRUS_COMMAND)) { if (!empty($conf->global->MAIN_ANTIVIRUS_COMMAND)) {
print ' &nbsp; - '.$conf->global->MAIN_ANTIVIRUS_COMMAND; print ' &nbsp; - '.$conf->global->MAIN_ANTIVIRUS_COMMAND;

View File

@ -65,7 +65,7 @@ if ($action == 'update') {
$db->begin(); $db->begin();
$res = dolibarr_set_const($db, 'TAX_MODE', $tax_mode, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, 'TAX_MODE', $tax_mode, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
switch ($tax_mode) switch ($tax_mode)
{ {
@ -90,13 +90,13 @@ if ($action == 'update') {
} }
$res = dolibarr_set_const($db, 'TAX_MODE_SELL_PRODUCT', $valuesellproduct, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, 'TAX_MODE_SELL_PRODUCT', $valuesellproduct, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
$res = dolibarr_set_const($db, 'TAX_MODE_BUY_PRODUCT', $valuebuyproduct, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, 'TAX_MODE_BUY_PRODUCT', $valuebuyproduct, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
$res = dolibarr_set_const($db, 'TAX_MODE_SELL_SERVICE', $valuesellservice, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, 'TAX_MODE_SELL_SERVICE', $valuesellservice, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
$res = dolibarr_set_const($db, 'TAX_MODE_BUY_SERVICE', $valuebuyservice, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, 'TAX_MODE_BUY_SERVICE', $valuebuyservice, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
dolibarr_set_const($db, "MAIN_INFO_TVAINTRA", GETPOST("tva", 'alpha'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_TVAINTRA", GETPOST("tva", 'alpha'), 'chaine', 0, '', $conf->entity);

View File

@ -59,7 +59,7 @@ if ($action == 'updateMask') {
$res = dolibarr_set_const($db, $maskconstticket, $maskticket, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, $maskconstticket, $maskticket, 'chaine', 0, '', $conf->entity);
} }
if (!$res > 0) { if (!($res > 0)) {
$error++; $error++;
} }
@ -113,7 +113,7 @@ elseif ($action == 'setmod') {
} else { } else {
$res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_EMAIL_FROM', '', 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_EMAIL_FROM', '', 'chaine', 0, '', $conf->entity);
} }
if (!$res > 0) { if (!($res > 0)) {
$error++; $error++;
} }
@ -124,7 +124,7 @@ elseif ($action == 'setmod') {
} else { } else {
$res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_EMAIL_TO', '', 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_EMAIL_TO', '', 'chaine', 0, '', $conf->entity);
} }
if (!$res > 0) { if (!($res > 0)) {
$error++; $error++;
} }
@ -134,7 +134,7 @@ elseif ($action == 'setmod') {
} else { } else {
$res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_INTRO', $langs->trans('TicketMessageMailIntroText'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_INTRO', $langs->trans('TicketMessageMailIntroText'), 'chaine', 0, '', $conf->entity);
} }
if (!$res > 0) { if (!($res > 0)) {
$error++; $error++;
} }
@ -144,7 +144,7 @@ elseif ($action == 'setmod') {
} else { } else {
$res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_SIGNATURE', $langs->trans('TicketMessageMailSignatureText'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_SIGNATURE', $langs->trans('TicketMessageMailSignatureText'), 'chaine', 0, '', $conf->entity);
} }
if (!$res > 0) { if (!($res > 0)) {
$error++; $error++;
} }
} }
@ -152,13 +152,13 @@ elseif ($action == 'setmod') {
if ($action == 'setvarother') { if ($action == 'setvarother') {
$param_must_exists = GETPOST('TICKET_EMAIL_MUST_EXISTS', 'alpha'); $param_must_exists = GETPOST('TICKET_EMAIL_MUST_EXISTS', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_EMAIL_MUST_EXISTS', $param_must_exists, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, 'TICKET_EMAIL_MUST_EXISTS', $param_must_exists, 'chaine', 0, '', $conf->entity);
if (!$res > 0) { if (!($res > 0)) {
$error++; $error++;
} }
$param_disable_email = GETPOST('TICKET_DISABLE_NOTIFICATION_MAILS', 'alpha'); $param_disable_email = GETPOST('TICKET_DISABLE_NOTIFICATION_MAILS', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_DISABLE_NOTIFICATION_MAILS', $param_disable_email, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, 'TICKET_DISABLE_NOTIFICATION_MAILS', $param_disable_email, 'chaine', 0, '', $conf->entity);
if (!$res > 0) { if (!($res > 0)) {
$error++; $error++;
} }
@ -166,7 +166,7 @@ if ($action == 'setvarother') {
{ {
$param_show_module_logo = GETPOST('TICKET_SHOW_MODULE_LOGO', 'alpha'); $param_show_module_logo = GETPOST('TICKET_SHOW_MODULE_LOGO', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_SHOW_MODULE_LOGO', $param_show_module_logo, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, 'TICKET_SHOW_MODULE_LOGO', $param_show_module_logo, 'chaine', 0, '', $conf->entity);
if (!$res > 0) { if (!($res > 0)) {
$error++; $error++;
} }
} }
@ -175,20 +175,20 @@ if ($action == 'setvarother') {
{ {
$param_notification_also_main_addressemail = GETPOST('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', 'alpha'); $param_notification_also_main_addressemail = GETPOST('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', $param_notification_also_main_addressemail, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', $param_notification_also_main_addressemail, 'chaine', 0, '', $conf->entity);
if (!$res > 0) { if (!($res > 0)) {
$error++; $error++;
} }
} }
$param_limit_view = GETPOST('TICKET_LIMIT_VIEW_ASSIGNED_ONLY', 'alpha'); $param_limit_view = GETPOST('TICKET_LIMIT_VIEW_ASSIGNED_ONLY', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_LIMIT_VIEW_ASSIGNED_ONLY', $param_limit_view, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, 'TICKET_LIMIT_VIEW_ASSIGNED_ONLY', $param_limit_view, 'chaine', 0, '', $conf->entity);
if (!$res > 0) { if (!($res > 0)) {
$error++; $error++;
} }
$param_auto_assign = GETPOST('TICKET_AUTO_ASSIGN_USER_CREATE', 'alpha'); $param_auto_assign = GETPOST('TICKET_AUTO_ASSIGN_USER_CREATE', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_AUTO_ASSIGN_USER_CREATE', $param_auto_assign, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, 'TICKET_AUTO_ASSIGN_USER_CREATE', $param_auto_assign, 'chaine', 0, '', $conf->entity);
if (!$res > 0) { if (!($res > 0)) {
$error++; $error++;
} }
} }

View File

@ -63,7 +63,7 @@ if ($action == 'setvar') {
} else { } else {
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_INTERFACE_TOPIC', '', 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, 'TICKET_PUBLIC_INTERFACE_TOPIC', '', 'chaine', 0, '', $conf->entity);
} }
if (!$res > 0) { if (!($res > 0)) {
$error++; $error++;
} }
@ -73,7 +73,7 @@ if ($action == 'setvar') {
} else { } else {
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HOME', $langs->trans('TicketPublicInterfaceTextHome'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HOME', $langs->trans('TicketPublicInterfaceTextHome'), 'chaine', 0, '', $conf->entity);
} }
if (!$res > 0) { if (!($res > 0)) {
$error++; $error++;
} }
@ -83,7 +83,7 @@ if ($action == 'setvar') {
} else { } else {
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HELP_MESSAGE', $langs->trans('TicketPublicPleaseBeAccuratelyDescribe'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HELP_MESSAGE', $langs->trans('TicketPublicPleaseBeAccuratelyDescribe'), 'chaine', 0, '', $conf->entity);
} }
if (!$res > 0) { if (!($res > 0)) {
$error++; $error++;
} }
@ -93,7 +93,7 @@ if ($action == 'setvar') {
} else { } else {
$res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_NEW', $langs->trans('TicketMessageMailNewText'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_NEW', $langs->trans('TicketMessageMailNewText'), 'chaine', 0, '', $conf->entity);
} }
if (!$res > 0) { if (!($res > 0)) {
$error++; $error++;
} }
@ -103,13 +103,13 @@ if ($action == 'setvar') {
} else { } else {
$res = dolibarr_set_const($db, 'TICKET_URL_PUBLIC_INTERFACE', '', 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, 'TICKET_URL_PUBLIC_INTERFACE', '', 'chaine', 0, '', $conf->entity);
} }
if (!$res > 0) { if (!($res > 0)) {
$error++; $error++;
} }
$param_public_notification_new_message_default_email = GETPOST('TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL', 'alpha'); $param_public_notification_new_message_default_email = GETPOST('TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL', $param_public_notification_new_message_default_email, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, 'TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL', $param_public_notification_new_message_default_email, 'chaine', 0, '', $conf->entity);
if (!$res > 0) { if (!($res > 0)) {
$error++; $error++;
} }
} }
@ -117,25 +117,25 @@ if ($action == 'setvar') {
if ($action == 'setvarother') { if ($action == 'setvarother') {
$param_enable_public_interface = GETPOST('TICKET_ENABLE_PUBLIC_INTERFACE', 'alpha'); $param_enable_public_interface = GETPOST('TICKET_ENABLE_PUBLIC_INTERFACE', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_ENABLE_PUBLIC_INTERFACE', $param_enable_public_interface, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, 'TICKET_ENABLE_PUBLIC_INTERFACE', $param_enable_public_interface, 'chaine', 0, '', $conf->entity);
if (!$res > 0) { if (!($res > 0)) {
$error++; $error++;
} }
$param_must_exists = GETPOST('TICKET_EMAIL_MUST_EXISTS', 'alpha'); $param_must_exists = GETPOST('TICKET_EMAIL_MUST_EXISTS', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_EMAIL_MUST_EXISTS', $param_must_exists, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, 'TICKET_EMAIL_MUST_EXISTS', $param_must_exists, 'chaine', 0, '', $conf->entity);
if (!$res > 0) { if (!($res > 0)) {
$error++; $error++;
} }
$param_disable_email = GETPOST('TICKET_DISABLE_CUSTOMER_MAILS', 'alpha'); $param_disable_email = GETPOST('TICKET_DISABLE_CUSTOMER_MAILS', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_DISABLE_CUSTOMER_MAILS', $param_disable_email, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, 'TICKET_DISABLE_CUSTOMER_MAILS', $param_disable_email, 'chaine', 0, '', $conf->entity);
if (!$res > 0) { if (!($res > 0)) {
$error++; $error++;
} }
$param_show_module_logo = GETPOST('TICKET_SHOW_COMPANY_LOGO', 'alpha'); $param_show_module_logo = GETPOST('TICKET_SHOW_COMPANY_LOGO', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_SHOW_COMPANY_LOGO', $param_show_module_logo, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, 'TICKET_SHOW_COMPANY_LOGO', $param_show_module_logo, 'chaine', 0, '', $conf->entity);
if (!$res > 0) { if (!($res > 0)) {
$error++; $error++;
} }
@ -143,7 +143,7 @@ if ($action == 'setvarother') {
{ {
$param_notification_also_main_addressemail = GETPOST('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', 'alpha'); $param_notification_also_main_addressemail = GETPOST('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', $param_notification_also_main_addressemail, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', $param_notification_also_main_addressemail, 'chaine', 0, '', $conf->entity);
if (!$res > 0) { if (!($res > 0)) {
$error++; $error++;
} }
} }

View File

@ -80,7 +80,7 @@ $_SESSION["commandbackuptorun"] = '';
$_SESSION["commandbackupresult"] = ''; $_SESSION["commandbackupresult"] = '';
// Increase limit of time. Works only if we are not in safe mode // Increase limit of time. Works only if we are not in safe mode
$ExecTimeLimit = 600; $ExecTimeLimit = 600; // Set it to 0 to not use a forced time limit
if (!empty($ExecTimeLimit)) if (!empty($ExecTimeLimit))
{ {
$err = error_reporting(); $err = error_reporting();
@ -95,8 +95,6 @@ if (!empty($MemoryLimit))
@ini_set('memory_limit', $MemoryLimit); @ini_set('memory_limit', $MemoryLimit);
} }
$form = new Form($db);
$formfile = new FormFile($db);
//$help_url='EN:Backups|FR:Sauvegardes|ES:Copias_de_seguridad'; //$help_url='EN:Backups|FR:Sauvegardes|ES:Copias_de_seguridad';
//llxHeader('','',$help_url); //llxHeader('','',$help_url);
@ -222,16 +220,7 @@ if ($errormsg)
} }
/*
$filearray=dol_dir_list($conf->admin->dir_output.'/backup','files',0,'','',$sortfield,(strtolower($sortorder)=='asc'?SORT_ASC:SORT_DESC),1);
$result=$formfile->list_of_documents($filearray,null,'systemtools','',1,'backup/',1,0,($langs->trans("NoBackupFileAvailable").'<br>'.$langs->trans("ToBuildBackupFileClickHere",DOL_URL_ROOT.'/admin/tools/dolibarr_export.php')),0,$langs->trans("PreviousDumpFiles"));
print '<br>';
*/
// Redirect to backup page // Redirect to backup page
header("Location: dolibarr_export.php".(GETPOST('page_y', 'int') ? '?page_y='.GETPOST('page_y', 'int') : '')); header("Location: dolibarr_export.php".(GETPOST('page_y', 'int') ? '?page_y='.GETPOST('page_y', 'int') : ''));
$time_end = time();
$db->close(); $db->close();

View File

@ -435,9 +435,6 @@ if ($id)
// Form to add a new line // Form to add a new line
if ($tabname[$id]) if ($tabname[$id])
{ {
$alabelisused = 0;
$var = false;
$fieldlist = explode(',', $tabfield[$id]); $fieldlist = explode(',', $tabfield[$id]);
// Line for title // Line for title
@ -461,7 +458,6 @@ if ($id)
} else print $valuetoshow; } else print $valuetoshow;
print '</td>'; print '</td>';
} }
if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') $alabelisused = 1;
} }
print '<td colspan="4">'; print '<td colspan="4">';
@ -469,7 +465,7 @@ if ($id)
print '</tr>'; print '</tr>';
// Line to enter new values // Line to enter new values
print "<tr ".$bcnd[$var].">"; print '<tr class="oddeven">';
$obj = new stdClass(); $obj = new stdClass();
// If data was already input, we define them in obj to populate input fields. // If data was already input, we define them in obj to populate input fields.
@ -570,7 +566,7 @@ if ($id)
print '&nbsp;<input type="submit" class="button button-cancel" name="actioncancel" value="'.$langs->trans("Cancel").'"></td>'; print '&nbsp;<input type="submit" class="button button-cancel" name="actioncancel" value="'.$langs->trans("Cancel").'"></td>';
} else { } else {
$tmpaction = 'view'; $tmpaction = 'view';
$parameters = array('var'=>$var, 'fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); $parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
$reshook = $hookmanager->executeHooks('viewWebsiteFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('viewWebsiteFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
$error = $hookmanager->error; $errors = $hookmanager->errors; $error = $hookmanager->error; $errors = $hookmanager->errors;

View File

@ -67,7 +67,7 @@ if ($action == 'updateMask')
if ($maskconstorder) $res = dolibarr_set_const($db, $maskconstorder, $maskorder, 'chaine', 0, '', $conf->entity); if ($maskconstorder) $res = dolibarr_set_const($db, $maskconstorder, $maskorder, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!($res > 0)) $error++;
if (!$error) if (!$error)
{ {

View File

@ -425,7 +425,7 @@ class Documents extends DolibarrApi
throw new RestException(500, 'Error while fetching object: '.$object->error); throw new RestException(500, 'Error while fetching object: '.$object->error);
} }
$upload_dir = $conf->product->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 0, $object, 'product').dol_sanitizeFileName($object->ref); $upload_dir = $conf->product->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 1, $object, 'product');
} }
elseif ($modulepart == 'agenda' || $modulepart == 'action' || $modulepart == 'event') elseif ($modulepart == 'agenda' || $modulepart == 'action' || $modulepart == 'event')
{ {

View File

@ -22,6 +22,11 @@
* \ingroup member * \ingroup member
* \brief Page to print sheets with barcodes using the document templates into core/modules/printsheets * \brief Page to print sheets with barcodes using the document templates into core/modules/printsheets
*/ */
if (!empty($_POST['mode']) && $_POST['mode'] === 'label') { // Page is called to build a PDF and output, we must ne renew the token.
if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on)
}
require '../main.inc.php'; require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/format_cards.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/format_cards.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@ -237,16 +242,22 @@ if ($action == 'builddoc')
$outfile = $langs->trans("BarCode").'_sheets_'.dol_print_date(dol_now(), 'dayhourlog').'.pdf'; $outfile = $langs->trans("BarCode").'_sheets_'.dol_print_date(dol_now(), 'dayhourlog').'.pdf';
if (!$mesg) $result = doc_label_pdf_create($db, $arrayofrecords, $modellabel, $outputlangs, $diroutput, $template, dol_sanitizeFileName($outfile)); if (!$mesg) {
$outputlangs = $langs;
// This generates and send PDF to output
// TODO Move
$result = doc_label_pdf_create($db, $arrayofrecords, $modellabel, $outputlangs, $diroutput, $template, dol_sanitizeFileName($outfile));
}
} }
if ($result <= 0) if ($result <= 0 || $mesg) {
{ if (empty($mesg)) {
dol_print_error('', $result); $mesg = 'Error '.$result;
} }
if (!$mesg) setEventMessages($mesg, null, 'errors');
{ } else {
$db->close(); $db->close();
exit; exit;
} }
@ -275,10 +286,10 @@ dol_htmloutput_errors($mesg);
//print img_picto('','puce').' '.$langs->trans("PrintsheetForOneBarCode").'<br>'; //print img_picto('','puce').' '.$langs->trans("PrintsheetForOneBarCode").'<br>';
//print '<br>'; //print '<br>';
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; // The target is for brothers that open the file instead of downloading it
print '<input type="hidden" name="mode" value="label">'; print '<input type="hidden" name="mode" value="label">';
print '<input type="hidden" name="action" value="builddoc">'; print '<input type="hidden" name="action" value="builddoc">';
print '<input type="hidden" name="token" value="'.newtoken().'">'; print '<input type="hidden" name="token" value="'.currentToken().'">'; // The page will not renew the token but force download of a file, so we must use here currentToken
print '<div class="tagtable">'; print '<div class="tagtable">';

View File

@ -38,7 +38,7 @@ if ($action == 'setvalue') {
$showmenu = GETPOST('BOOKMARKS_SHOW_IN_MENU', 'alpha'); $showmenu = GETPOST('BOOKMARKS_SHOW_IN_MENU', 'alpha');
$res = dolibarr_set_const($db, "BOOKMARKS_SHOW_IN_MENU", $showmenu, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "BOOKMARKS_SHOW_IN_MENU", $showmenu, 'chaine', 0, '', $conf->entity);
if (!$res > 0) { if (!($res > 0)) {
$error++; $error++;
} }

View File

@ -62,7 +62,7 @@ if (GETPOST('action', 'alpha') == 'set')
dol_syslog("admin/cashdesk: level ".GETPOST('level', 'alpha')); dol_syslog("admin/cashdesk: level ".GETPOST('level', 'alpha'));
if (!$res > 0) $error++; if (!($res > 0)) $error++;
if (!$error) if (!$error)
{ {

View File

@ -318,7 +318,7 @@ switch ($action)
if ($invoice->total_ttc == $obj_facturation->amountWithTax() if ($invoice->total_ttc == $obj_facturation->amountWithTax()
&& $obj_facturation->getSetPaymentMode() != 'DIFF') && $obj_facturation->getSetPaymentMode() != 'DIFF')
{ {
// We set status to payed // We set status to paid
$result = $invoice->set_paid($user); $result = $invoice->set_paid($user);
//print 'set paid';exit; //print 'set paid';exit;
} }

View File

@ -114,7 +114,7 @@ if ($action == 'delete')
if ($res > 0) if ($res > 0)
{ {
$res = $objectpage->delete($user); $res = $objectpage->delete($user);
if (!$res > 0) if (!($res > 0))
{ {
$error++; $error++;
setEventMessages($objectpage->error, $objectpage->errors, 'errors'); setEventMessages($objectpage->error, $objectpage->errors, 'errors');

View File

@ -228,8 +228,8 @@ if (empty($reshook) && $action == 'add')
$percentage = in_array(GETPOST('status'), array(-1, 100)) ?GETPOST('status') : (in_array(GETPOST('complete'), array(-1, 100)) ?GETPOST('complete') : GETPOST("percentage")); // If status is -1 or 100, percentage is not defined and we must use status $percentage = in_array(GETPOST('status'), array(-1, 100)) ?GETPOST('status') : (in_array(GETPOST('complete'), array(-1, 100)) ?GETPOST('complete') : GETPOST("percentage")); // If status is -1 or 100, percentage is not defined and we must use status
// Clean parameters // Clean parameters
$datep = dol_mktime($fulldayevent ? '00' : GETPOST("aphour", 'int'), $fulldayevent ? '00' : GETPOST("apmin", 'int'), $fulldayevent ? '00' : GETPOST("apsec", 'int'), GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int')); $datep = dol_mktime($fulldayevent ? '00' : GETPOST("aphour", 'int'), $fulldayevent ? '00' : GETPOST("apmin", 'int'), $fulldayevent ? '00' : GETPOST("apsec", 'int'), GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int'), 'tzuser');
$datef = dol_mktime($fulldayevent ? '23' : GETPOST("p2hour", 'int'), $fulldayevent ? '59' : GETPOST("p2min", 'int'), $fulldayevent ? '59' : GETPOST("apsec", 'int'), GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int')); $datef = dol_mktime($fulldayevent ? '23' : GETPOST("p2hour", 'int'), $fulldayevent ? '59' : GETPOST("p2min", 'int'), $fulldayevent ? '59' : GETPOST("apsec", 'int'), GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'), 'tzuser');
// Check parameters // Check parameters
if (!$datef && $percentage == 100) if (!$datef && $percentage == 100)
@ -479,8 +479,8 @@ if (empty($reshook) && $action == 'update')
$object->fetch_userassigned(); $object->fetch_userassigned();
$object->oldcopy = clone $object; $object->oldcopy = clone $object;
$datep = dol_mktime($fulldayevent ? '00' : $aphour, $fulldayevent ? '00' : $apmin, 0, GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int')); $datep = dol_mktime($fulldayevent ? '00' : $aphour, $fulldayevent ? '00' : $apmin, 0, GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int'), 'tzuser');
$datef = dol_mktime($fulldayevent ? '23' : $p2hour, $fulldayevent ? '59' : $p2min, $fulldayevent ? '59' : '0', GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int')); $datef = dol_mktime($fulldayevent ? '23' : $p2hour, $fulldayevent ? '59' : $p2min, $fulldayevent ? '59' : '0', GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'), 'tzuser');
$object->type_id = dol_getIdFromCode($db, GETPOST("actioncode", 'aZ09'), 'c_actioncomm'); $object->type_id = dol_getIdFromCode($db, GETPOST("actioncode", 'aZ09'), 'c_actioncomm');
$object->label = GETPOST("label", "alphanohtml"); $object->label = GETPOST("label", "alphanohtml");
@ -953,7 +953,7 @@ if ($action == 'create')
// Full day // Full day
print '<tr><td>'.$langs->trans("EventOnFullDay").'</td><td><input type="checkbox" id="fullday" name="fullday" '.(GETPOST('fullday') ? ' checked' : '').'></td></tr>'; print '<tr><td>'.$langs->trans("EventOnFullDay").'</td><td><input type="checkbox" id="fullday" name="fullday" '.(GETPOST('fullday') ? ' checked' : '').'></td></tr>';
$datep = ($datep ? $datep : $object->datep); $datep = ($datep ? $datep : (is_null($object->datep) ? '' : $object->datep));
if (GETPOST('datep', 'int', 1)) $datep = dol_stringtotime(GETPOST('datep', 'int', 1), 0); if (GETPOST('datep', 'int', 1)) $datep = dol_stringtotime(GETPOST('datep', 'int', 1), 0);
$datef = ($datef ? $datef : $object->datef); $datef = ($datef ? $datef : $object->datef);
if (GETPOST('datef', 'int', 1)) $datef = dol_stringtotime(GETPOST('datef', 'int', 1), 0); if (GETPOST('datef', 'int', 1)) $datef = dol_stringtotime(GETPOST('datef', 'int', 1), 0);
@ -1324,8 +1324,8 @@ if ($id > 0)
{ {
$percentage = in_array(GETPOST('status'), array(-1, 100)) ?GETPOST('status') : (in_array(GETPOST('complete'), array(-1, 100)) ?GETPOST('complete') : GETPOST("percentage")); // If status is -1 or 100, percentage is not defined and we must use status $percentage = in_array(GETPOST('status'), array(-1, 100)) ?GETPOST('status') : (in_array(GETPOST('complete'), array(-1, 100)) ?GETPOST('complete') : GETPOST("percentage")); // If status is -1 or 100, percentage is not defined and we must use status
$datep = dol_mktime($fulldayevent ? '00' : $aphour, $fulldayevent ? '00' : $apmin, 0, GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int')); $datep = dol_mktime($fulldayevent ? '00' : $aphour, $fulldayevent ? '00' : $apmin, 0, GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int'), 'tzuser');
$datef = dol_mktime($fulldayevent ? '23' : $p2hour, $fulldayevent ? '59' : $p2min, $fulldayevent ? '59' : '0', GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int')); $datef = dol_mktime($fulldayevent ? '23' : $p2hour, $fulldayevent ? '59' : $p2min, $fulldayevent ? '59' : '0', GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'), 'tzuser');
$object->type_id = dol_getIdFromCode($db, GETPOST("actioncode", 'aZ09'), 'c_actioncomm'); $object->type_id = dol_getIdFromCode($db, GETPOST("actioncode", 'aZ09'), 'c_actioncomm');
$object->label = GETPOST("label", "alphanohtml"); $object->label = GETPOST("label", "alphanohtml");
@ -1430,23 +1430,23 @@ if ($id > 0)
// Full day event // Full day event
print '<tr><td>'.$langs->trans("EventOnFullDay").'</td><td colspan="3"><input type="checkbox" id="fullday" name="fullday" '.($object->fulldayevent ? ' checked' : '').'></td></tr>'; print '<tr><td>'.$langs->trans("EventOnFullDay").'</td><td colspan="3"><input type="checkbox" id="fullday" name="fullday" '.($object->fulldayevent ? ' checked' : '').'></td></tr>';
print dol_print_date($object->datep, 'dayhour', 'gmt');
// Date start - end // Date start - end
print '<tr><td class="nowrap"><span class="fieldrequired">'.$langs->trans("DateActionStart").' - '.$langs->trans("DateActionEnd").'</span></td><td colspan="3">'; print '<tr><td class="nowrap"><span class="fieldrequired">'.$langs->trans("DateActionStart").' - '.$langs->trans("DateActionEnd").'</span></td><td colspan="3">';
if (GETPOST("afaire") == 1) { if (GETPOST("afaire") == 1) {
print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 0, "action", 1, 1, 0, 'fulldaystart'); print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 0, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', 'tzuser');
} elseif (GETPOST("afaire") == 2) { } elseif (GETPOST("afaire") == 2) {
print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart'); print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', 'tzuser');
} else { } else {
print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart'); print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', 'tzuser');
} }
print ' - '; print ' - ';
if (GETPOST("afaire") == 1) { if (GETPOST("afaire") == 1) {
print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend'); print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend', '', '', '', 1, '', '', 'tzuser');
} elseif (GETPOST("afaire") == 2) { } elseif (GETPOST("afaire") == 2) {
print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend'); print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend', '', '', '', 1, '', '', 'tzuser');
} else { } else {
print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend'); print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend', '', '', '', 1, '', '', 'tzuser');
} }
print '</td></tr>'; print '</td></tr>';
@ -1884,16 +1884,16 @@ if ($id > 0)
// Date start // Date start
print '<tr><td>'.$langs->trans("DateActionStart").'</td><td>'; print '<tr><td>'.$langs->trans("DateActionStart").'</td><td>';
if (!$object->fulldayevent) print dol_print_date($object->datep, 'dayhour'); if (!$object->fulldayevent) print dol_print_date($object->datep, 'dayhour', 'tzuser');
else print dol_print_date($object->datep, 'day'); else print dol_print_date($object->datep, 'day', 'tzuser');
if ($object->percentage == 0 && $object->datep && $object->datep < ($now - $delay_warning)) print img_warning($langs->trans("Late")); if ($object->percentage == 0 && $object->datep && $object->datep < ($now - $delay_warning)) print img_warning($langs->trans("Late"));
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
// Date end // Date end
print '<tr><td>'.$langs->trans("DateActionEnd").'</td><td>'; print '<tr><td>'.$langs->trans("DateActionEnd").'</td><td>';
if (!$object->fulldayevent) print dol_print_date($object->datef, 'dayhour'); if (!$object->fulldayevent) print dol_print_date($object->datef, 'dayhour', 'tzuser');
else print dol_print_date($object->datef, 'day'); else print dol_print_date($object->datef, 'day', 'tzuser');
if ($object->percentage > 0 && $object->percentage < 100 && $object->datef && $object->datef < ($now - $delay_warning)) print img_warning($langs->trans("Late")); if ($object->percentage > 0 && $object->percentage < 100 && $object->datef && $object->datef < ($now - $delay_warning)) print img_warning($langs->trans("Late"));
print '</td></tr>'; print '</td></tr>';

View File

@ -1222,13 +1222,20 @@ class ActionComm extends CommonObject
} }
$sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a"; $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a";
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc"; if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
if (!$user->rights->agenda->allactions->read) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."actioncomm_resources AS ar ON a.id = ar.fk_actioncomm AND ar.element_type ='user' AND ar.fk_element = ".$user->id;
}
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
$sql .= " WHERE 1 = 1"; $sql .= " WHERE 1 = 1";
if (empty($load_state_board)) $sql .= " AND a.percent >= 0 AND a.percent < 100"; if (empty($load_state_board)) $sql .= " AND a.percent >= 0 AND a.percent < 100";
$sql .= " AND a.entity IN (".getEntity('agenda').")"; $sql .= " AND a.entity IN (".getEntity('agenda').")";
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND (a.fk_soc IS NULL OR sc.fk_user = ".$user->id.")"; if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND (a.fk_soc IS NULL OR sc.fk_user = ".$user->id.")";
if ($user->socid) $sql .= " AND a.fk_soc = ".$user->socid; if ($user->socid) $sql .= " AND a.fk_soc = ".$user->socid;
if (!$user->rights->agenda->allactions->read) $sql .= " AND (a.fk_user_author = ".$user->id." OR a.fk_user_action = ".$user->id." OR a.fk_user_done = ".$user->id.")"; if (!$user->rights->agenda->allactions->read) {
$sql .= " AND (a.fk_user_author = ".$user->id." OR a.fk_user_action = ".$user->id." OR a.fk_user_done = ".$user->id;
$sql .= " OR ar.fk_element = ".$user->id; // Added by PV
$sql .= ")";
}
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)

View File

@ -514,7 +514,7 @@ if (!empty($conf->use_javascript_ajax)) // If javascript on
{ {
$s .= '<script type="text/javascript">'."\n"; $s .= '<script type="text/javascript">'."\n";
$s .= 'jQuery(document).ready(function () { $s .= 'jQuery(document).ready(function () {
jQuery("table input[name^=\"check_ext\"]").click(function() { jQuery("div input[name^=\"check_ext\"]").click(function() {
var name = $(this).attr("name"); var name = $(this).attr("name");
jQuery(".family_ext" + name.replace("check_ext", "")).toggle(); jQuery(".family_ext" + name.replace("check_ext", "")).toggle();
}); });
@ -524,7 +524,7 @@ if (!empty($conf->use_javascript_ajax)) // If javascript on
foreach ($showextcals as $val) foreach ($showextcals as $val)
{ {
$htmlname = md5($val['name']); $htmlname = md5($val['name']);
$s .= '<div class="nowrap inline-block"><input type="checkbox" id="check_ext'.$htmlname.'" name="check_ext'.$htmlname.'" checked> '.$val['name'].' &nbsp; </div>'; $s .= '<div class="nowrap inline-block"><input type="checkbox" id="check_ext'.$htmlname.'" name="check_ext'.$htmlname.'" checked> <label for="check_ext'.$htmlname.'">'.$val['name'].'</label> &nbsp; </div>';
} }
} }
@ -1716,7 +1716,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
// Hour start // Hour start
if ($tmpyearstart == $annee && $tmpmonthstart == $mois && $tmpdaystart == $jour) if ($tmpyearstart == $annee && $tmpmonthstart == $mois && $tmpdaystart == $jour)
{ {
$daterange .= dol_print_date($event->date_start_in_calendar, 'hour'); // Il faudrait utiliser ici tzuser, mais si on ne peut pas car qd on rentre un date dans fiche action, en input la conversion local->gmt se base sur le TZ server et non user $daterange .= dol_print_date($event->date_start_in_calendar, 'hour', 'tzuser');
if ($event->date_end_in_calendar && $event->date_start_in_calendar != $event->date_end_in_calendar) if ($event->date_end_in_calendar && $event->date_start_in_calendar != $event->date_end_in_calendar)
{ {
if ($tmpyearstart == $tmpyearend && $tmpmonthstart == $tmpmonthend && $tmpdaystart == $tmpdayend) if ($tmpyearstart == $tmpyearend && $tmpmonthstart == $tmpmonthend && $tmpdaystart == $tmpdayend)
@ -1736,7 +1736,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
if ($event->date_end_in_calendar && $event->date_start_in_calendar != $event->date_end_in_calendar) if ($event->date_end_in_calendar && $event->date_start_in_calendar != $event->date_end_in_calendar)
{ {
if ($tmpyearend == $annee && $tmpmonthend == $mois && $tmpdayend == $jour) if ($tmpyearend == $annee && $tmpmonthend == $mois && $tmpdayend == $jour)
$daterange .= dol_print_date($event->date_end_in_calendar, 'hour'); // Il faudrait utiliser ici tzuser, mais si on ne peut pas car qd on rentre un date dans fiche action, en input la conversion local->gmt se base sur le TZ server et non user $daterange .= dol_print_date($event->date_end_in_calendar, 'hour', 'tzuser');
} }
} else { } else {
if ($showinfo) if ($showinfo)

View File

@ -136,9 +136,9 @@ $arrayfields = array(
's.nom'=>array('label'=>"ThirdParty", 'checked'=>1), 's.nom'=>array('label'=>"ThirdParty", 'checked'=>1),
'a.fk_contact'=>array('label'=>"Contact", 'checked'=>0), 'a.fk_contact'=>array('label'=>"Contact", 'checked'=>0),
'a.fk_element'=>array('label'=>"LinkedObject", 'checked'=>1, 'enabled'=>(!empty($conf->global->AGENDA_SHOW_LINKED_OBJECT))), 'a.fk_element'=>array('label'=>"LinkedObject", 'checked'=>1, 'enabled'=>(!empty($conf->global->AGENDA_SHOW_LINKED_OBJECT))),
'a.percent'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000), 'a.datec'=>array('label'=>'DateCreation', 'checked'=>0, 'position'=>510),
'a.datec'=>array('label'=>'DateCreation', 'checked'=>0), 'a.tms'=>array('label'=>'DateModification', 'checked'=>0, 'position'=>520),
'a.tms'=>array('label'=>'DateModification', 'checked'=>0) 'a.percent'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000)
); );
// Extra fields // Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
@ -366,7 +366,7 @@ if ($socid > 0) $sql .= " AND s.rowid = ".$socid;
if ($filtert > 0 || $usergroup > 0) $sql .= " AND ar.fk_actioncomm = a.id AND ar.element_type='user'"; if ($filtert > 0 || $usergroup > 0) $sql .= " AND ar.fk_actioncomm = a.id AND ar.element_type='user'";
if ($type) $sql .= " AND c.id = ".(int) $type; if ($type) $sql .= " AND c.id = ".(int) $type;
if ($search_status == '0') { $sql .= " AND a.percent = 0"; } if ($search_status == '0') { $sql .= " AND a.percent = 0"; }
if ($search_status == '-1') { $sql .= " AND a.percent = -1"; } // Not applicable if ($search_status == 'na') { $sql .= " AND a.percent = -1"; } // Not applicable
if ($search_status == '50') { $sql .= " AND (a.percent > 0 AND a.percent < 100)"; } // Running already started if ($search_status == '50') { $sql .= " AND (a.percent > 0 AND a.percent < 100)"; } // Running already started
if ($search_status == '100') { $sql .= " AND a.percent = 100"; } if ($search_status == '100') { $sql .= " AND a.percent = 100"; }
if ($search_status == 'done') { $sql .= " AND (a.percent = 100)"; } if ($search_status == 'done') { $sql .= " AND (a.percent = 100)"; }
@ -739,7 +739,7 @@ if ($resql)
// Start date // Start date
if (!empty($arrayfields['a.datep']['checked'])) { if (!empty($arrayfields['a.datep']['checked'])) {
print '<td class="center nowraponall">'; print '<td class="center nowraponall">';
print dol_print_date($db->jdate($obj->dp), $formatToUse); print dol_print_date($db->jdate($obj->dp), $formatToUse, 'tzuser');
$late = 0; $late = 0;
if ($obj->percent == 0 && $obj->dp && $db->jdate($obj->dp) < ($now - $delay_warning)) $late = 1; if ($obj->percent == 0 && $obj->dp && $db->jdate($obj->dp) < ($now - $delay_warning)) $late = 1;
if ($obj->percent == 0 && !$obj->dp && $obj->dp2 && $db->jdate($obj->dp) < ($now - $delay_warning)) $late = 1; if ($obj->percent == 0 && !$obj->dp && $obj->dp2 && $db->jdate($obj->dp) < ($now - $delay_warning)) $late = 1;
@ -752,7 +752,7 @@ if ($resql)
// End date // End date
if (!empty($arrayfields['a.datep2']['checked'])) { if (!empty($arrayfields['a.datep2']['checked'])) {
print '<td class="center nowraponall">'; print '<td class="center nowraponall">';
print dol_print_date($db->jdate($obj->dp2), $formatToUse); print dol_print_date($db->jdate($obj->dp2), $formatToUse, 'tzuser');
print '</td>'; print '</td>';
} }
@ -837,11 +837,11 @@ if ($resql)
// Date creation // Date creation
if (!empty($arrayfields['a.datec']['checked'])) { if (!empty($arrayfields['a.datec']['checked'])) {
// Status/Percent // Status/Percent
print '<td align="center" class="nowrap">'.dol_print_date($db->jdate($obj->datec), 'dayhour').'</td>'; print '<td align="center" class="nowrap">'.dol_print_date($db->jdate($obj->datec), 'dayhour', 'tzuser').'</td>';
} }
// Date update // Date update
if (!empty($arrayfields['a.tms']['checked'])) { if (!empty($arrayfields['a.tms']['checked'])) {
print '<td align="center" class="nowrap">'.dol_print_date($db->jdate($obj->datem), 'dayhour').'</td>'; print '<td align="center" class="nowrap">'.dol_print_date($db->jdate($obj->datem), 'dayhour', 'tzuser').'</td>';
} }
if (!empty($arrayfields['a.percent']['checked'])) { if (!empty($arrayfields['a.percent']['checked'])) {
// Status/Percent // Status/Percent

View File

@ -161,10 +161,18 @@ if (!empty($conf->propal->enabled) && $user->rights->propal->lire) {
if ($num > 0) { if ($num > 0) {
$i = 0; $i = 0;
$othernb = 0;
while ($i < $nbofloop) { while ($i < $num && $i < $conf->liste_limit) {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
if ($i >= $max) {
$othernb += 1;
$i++;
$total += (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc);
continue;
}
$propalstatic->id = $obj->rowid; $propalstatic->id = $obj->rowid;
$propalstatic->ref = $obj->ref; $propalstatic->ref = $obj->ref;
$propalstatic->ref_client = $obj->ref_client; $propalstatic->ref_client = $obj->ref_client;
@ -196,6 +204,14 @@ if (!empty($conf->propal->enabled) && $user->rights->propal->lire) {
$i++; $i++;
$total += (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc); $total += (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc);
} }
if ($othernb) {
print '<tr class="oddeven">';
print '<td class="nowrap" colspan="5">';
print '<span class="opacitymedium">'.$langs->trans("More").'... ('.$othernb.')</span>';
print '</td>';
print "</tr>\n";
}
} }
addSummaryTableLine(3, $num, $nbofloop, $total, "NoProposal"); addSummaryTableLine(3, $num, $nbofloop, $total, "NoProposal");
@ -236,10 +252,18 @@ if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposa
if ($num > 0) { if ($num > 0) {
$i = 0; $i = 0;
$othernb = 0;
while ($i < $nbofloop) { while ($i < $num && $i < $conf->liste_limit) {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
if ($i >= $max) {
$othernb += 1;
$i++;
$total += (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc);
continue;
}
$supplierproposalstatic->id = $obj->rowid; $supplierproposalstatic->id = $obj->rowid;
$supplierproposalstatic->ref = $obj->ref; $supplierproposalstatic->ref = $obj->ref;
$supplierproposalstatic->total_ht = $obj->total_ht; $supplierproposalstatic->total_ht = $obj->total_ht;
@ -270,6 +294,14 @@ if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposa
$i++; $i++;
$total += (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc); $total += (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc);
} }
if ($othernb) {
print '<tr class="oddeven">';
print '<td class="nowrap" colspan="5">';
print '<span class="opacitymedium">'.$langs->trans("More").'... ('.$othernb.')</span>';
print '</td>';
print "</tr>\n";
}
} }
addSummaryTableLine(3, $num, $nbofloop, $total, "NoProposal"); addSummaryTableLine(3, $num, $nbofloop, $total, "NoProposal");
@ -310,10 +342,18 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire) {
if ($num > 0) { if ($num > 0) {
$i = 0; $i = 0;
$othernb = 0;
while ($i < $nbofloop) { while ($i < $num && $i < $conf->liste_limit) {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
if ($i >= $max) {
$othernb += 1;
$i++;
$total += (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc);
continue;
}
$orderstatic->id = $obj->rowid; $orderstatic->id = $obj->rowid;
$orderstatic->ref = $obj->ref; $orderstatic->ref = $obj->ref;
$orderstatic->ref_client = $obj->ref_client; $orderstatic->ref_client = $obj->ref_client;
@ -345,6 +385,14 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire) {
$i++; $i++;
$total += (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc); $total += (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc);
} }
if ($othernb) {
print '<tr class="oddeven">';
print '<td class="nowrap" colspan="5">';
print '<span class="opacitymedium">'.$langs->trans("More").'... ('.$othernb.')</span>';
print '</td>';
print "</tr>\n";
}
} }
addSummaryTableLine(3, $num, $nbofloop, $total, "NoProposal"); addSummaryTableLine(3, $num, $nbofloop, $total, "NoProposal");
@ -385,10 +433,18 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU
if ($num > 0) { if ($num > 0) {
$i = 0; $i = 0;
$othernb = 0;
while ($i < $nbofloop) { while ($i < $num && $i < $conf->liste_limit) {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
if ($i >= $max) {
$othernb += 1;
$i++;
$total += (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc);
continue;
}
$supplierorderstatic->id = $obj->rowid; $supplierorderstatic->id = $obj->rowid;
$supplierorderstatic->ref = $obj->ref; $supplierorderstatic->ref = $obj->ref;
$supplierorderstatic->ref_supplier = $obj->ref_suppliert; $supplierorderstatic->ref_supplier = $obj->ref_suppliert;
@ -420,6 +476,14 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU
$i++; $i++;
$total += (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc); $total += (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc);
} }
if ($othernb) {
print '<tr class="oddeven">';
print '<td class="nowrap" colspan="5">';
print '<span class="opacitymedium">'.$langs->trans("More").'... ('.$othernb.')</span>';
print '</td>';
print "</tr>\n";
}
} }
addSummaryTableLine(3, $num, $nbofloop, $total, "NoProposal"); addSummaryTableLine(3, $num, $nbofloop, $total, "NoProposal");

View File

@ -119,9 +119,8 @@ llxHeader('', $langs->trans("Mailing"), 'EN:Module_EMailing|FR:Module_Mailing|ES
$form = new Form($db); $form = new Form($db);
if ($filteremail) if ($filteremail) {
{ $sql = "SELECT m.rowid, m.titre as title, m.nbemail, m.statut, m.date_creat as datec, m.date_envoi as date_envoi,";
$sql = "SELECT m.rowid, m.titre, m.nbemail, m.statut, m.date_creat as datec, m.date_envoi as date_envoi,";
$sql .= " mc.statut as sendstatut"; $sql .= " mc.statut as sendstatut";
$sql .= " FROM ".MAIN_DB_PREFIX."mailing as m, ".MAIN_DB_PREFIX."mailing_cibles as mc"; $sql .= " FROM ".MAIN_DB_PREFIX."mailing as m, ".MAIN_DB_PREFIX."mailing_cibles as mc";
$sql .= " WHERE m.rowid = mc.fk_mailing AND m.entity = ".$conf->entity; $sql .= " WHERE m.rowid = mc.fk_mailing AND m.entity = ".$conf->entity;
@ -131,7 +130,7 @@ if ($filteremail)
if (!$sortorder) $sortorder = "ASC"; if (!$sortorder) $sortorder = "ASC";
if (!$sortfield) $sortfield = "m.rowid"; if (!$sortfield) $sortfield = "m.rowid";
} else { } else {
$sql = "SELECT m.rowid, m.titre, m.nbemail, m.statut, m.date_creat as datec, m.date_envoi as date_envoi"; $sql = "SELECT m.rowid, m.titre as title, m.nbemail, m.statut, m.date_creat as datec, m.date_envoi as date_envoi";
$sql .= " FROM ".MAIN_DB_PREFIX."mailing as m"; $sql .= " FROM ".MAIN_DB_PREFIX."mailing as m";
$sql .= " WHERE m.entity = ".$conf->entity; $sql .= " WHERE m.entity = ".$conf->entity;
if ($search_ref) $sql .= " AND m.rowid = '".$db->escape($search_ref)."'"; if ($search_ref) $sql .= " AND m.rowid = '".$db->escape($search_ref)."'";
@ -238,9 +237,10 @@ if ($resql)
print $email->getNomUrl(1); print $email->getNomUrl(1);
print '</td>'; print '</td>';
// Title
print '<td>'.$obj->title.'</td>'; print '<td>'.$obj->title.'</td>';
// Date creation
// Date creation
print '<td class="center">'; print '<td class="center">';
print dol_print_date($db->jdate($obj->datec), 'day'); print dol_print_date($db->jdate($obj->datec), 'day');
print '</td>'; print '</td>';

View File

@ -354,8 +354,8 @@ if (empty($reshook))
$object->cond_reglement_id = GETPOST('cond_reglement_id'); $object->cond_reglement_id = GETPOST('cond_reglement_id');
$object->mode_reglement_id = GETPOST('mode_reglement_id'); $object->mode_reglement_id = GETPOST('mode_reglement_id');
$object->fk_account = GETPOST('fk_account', 'int'); $object->fk_account = GETPOST('fk_account', 'int');
$object->remise_percent = GETPOST('remise_percent'); $object->remise_percent = price2num(GETPOST('remise_percent'), 2);
$object->remise_absolue = GETPOST('remise_absolue'); $object->remise_absolue = price2num(GETPOST('remise_absolue'), 'MU');
$object->socid = GETPOST('socid', 'int'); $object->socid = GETPOST('socid', 'int');
$object->contact_id = GETPOST('contactid', 'int'); $object->contact_id = GETPOST('contactid', 'int');
$object->fk_project = GETPOST('projectid', 'int'); $object->fk_project = GETPOST('projectid', 'int');
@ -812,7 +812,7 @@ if (empty($reshook))
} }
$qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS'); $qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS');
$remise_percent = GETPOST('remise_percent'.$predef); $remise_percent = price2num(GETPOST('remise_percent'.$predef), 2);
if (empty($remise_percent)) $remise_percent = 0; if (empty($remise_percent)) $remise_percent = 0;
// Extrafields // Extrafields
@ -1210,7 +1210,7 @@ if (empty($reshook))
$price_min = $product->multiprices_min [$object->thirdparty->price_level]; $price_min = $product->multiprices_min [$object->thirdparty->price_level];
$label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : ''); $label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : '');
if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)) && ($price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent')) / 100) < price2num($price_min)))) { if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)) && ($price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent'), 2) / 100) < price2num($price_min)))) {
setEventMessages($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), null, 'errors'); setEventMessages($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), null, 'errors');
$error++; $error++;
} }
@ -1243,7 +1243,7 @@ if (empty($reshook))
$qty = price2num(GETPOST('qty', 'alpha'), 'MS'); $qty = price2num(GETPOST('qty', 'alpha'), 'MS');
$result = $object->updateline(GETPOST('lineid', 'int'), $pu_ht, $qty, GETPOST('remise_percent'), $vat_rate, $localtax1_rate, $localtax2_rate, $description, 'HT', $info_bits, $special_code, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $type, $date_start, $date_end, $array_options, $_POST["units"], $pu_ht_devise); $result = $object->updateline(GETPOST('lineid', 'int'), $pu_ht, $qty, price2num(GETPOST('remise_percent'), 2), $vat_rate, $localtax1_rate, $localtax2_rate, $description, 'HT', $info_bits, $special_code, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $type, $date_start, $date_end, $array_options, GETPOST("units"), $pu_ht_devise);
if ($result >= 0) { if ($result >= 0) {
$db->commit(); $db->commit();

View File

@ -271,6 +271,98 @@ if (empty($reshook))
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
} }
if ($action == 'validate') {
if (GETPOST('confirm') == 'yes') {
$tmpproposal = new Propal($db);
$db->begin();
$error = 0;
foreach ($toselect as $checked) {
if ($tmpproposal->fetch($checked)) {
if ($tmpproposal->statut == 0) {
if ($tmpproposal->valid($user)) {
setEventMessage($tmpproposal->ref." ".$langs->trans('PassedInOpenStatus'), 'mesgs');
} else {
setEventMessage($langs->trans('CantBeValidated'), 'errors');
$error++;
}
} else {
setEventMessage($tmpproposal->ref." ".$langs->trans('IsNotADraft'), 'errors');
$error++;
}
}
dol_print_error($db);
$error++;
}
if ($error) {
$db->rollback();
} else {
$db->commit();
}
}
}
if ($action == "sign") {
if (GETPOST('confirm') == 'yes') {
$tmpproposal = new Propal($db);
$db->begin();
$error = 0;
foreach ($toselect as $checked) {
if ($tmpproposal->fetch($checked)) {
if ($tmpproposal->statut == 1) {
$tmpproposal->statut = 2;
if ($tmpproposal->update($user)) {
setEventMessage($tmpproposal->ref." ".$langs->trans('Signed'), 'mesgs');
} else {
dol_print_error($db);
$error++;
}
} else {
setEventMessage($tmpproposal->ref." ".$langs->trans('CantBeSign'), 'errors');
$error++;
}
} else {
dol_print_error($db);
$error++;
}
}
if ($error) {
$db->rollback();
} else {
$db->commit();
}
}
}
if ($action == "nosign") {
if (GETPOST('confirm') == 'yes') {
$tmpproposal = new Propal($db);
$db->begin();
$error = 0;
foreach ($toselect as $checked) {
if ($tmpproposal->fetch($checked)) {
if ($tmpproposal->statut == 1) {
$tmpproposal->statut = 3;
if ($tmpproposal->update($user)) {
setEventMessage($tmpproposal->ref." ".$langs->trans('NoSigned'), 'mesgs');
} else {
dol_print_error($db);
$error++;
}
} else {
setEventMessage($tmpproposal->ref." ".$langs->trans('CantBeClosed'), 'errors');
$error++;
}
} else {
dol_print_error($db);
$error++;
}
}
if ($error) {
$db->rollback();
} else {
$db->commit();
}
}
}
/* /*
@ -291,7 +383,7 @@ $help_url = 'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos'
//llxHeader('',$langs->trans('Proposal'),$help_url); //llxHeader('',$langs->trans('Proposal'),$help_url);
$sql = 'SELECT'; $sql = 'SELECT';
if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT'; if ($sall || $search_product_category > 0 || $search_user > 0) $sql = 'SELECT DISTINCT';
$sql .= ' s.rowid as socid, s.nom as name, s.name_alias as alias, s.email, s.town, s.zip, s.fk_pays, s.client, s.code_client, '; $sql .= ' s.rowid as socid, s.nom as name, s.name_alias as alias, s.email, s.town, s.zip, s.fk_pays, s.client, s.code_client, ';
$sql .= " typent.code as typent_code,"; $sql .= " typent.code as typent_code,";
$sql .= " ava.rowid as availability,"; $sql .= " ava.rowid as availability,";
@ -493,6 +585,7 @@ if ($resql)
'presend'=>$langs->trans("SendByMail"), 'presend'=>$langs->trans("SendByMail"),
'prevalidate'=>$langs->trans("Validate"), 'prevalidate'=>$langs->trans("Validate"),
'presign'=>$langs->trans("Sign"), 'presign'=>$langs->trans("Sign"),
'nopresign'=>$langs->trans("NoSign"),
); );
if ($user->rights->propal->supprimer) $arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete"); if ($user->rights->propal->supprimer) $arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
if ($user->rights->propal->cloturer) $arrayofmassactions['closed'] = $langs->trans("Close"); if ($user->rights->propal->cloturer) $arrayofmassactions['closed'] = $langs->trans("Close");
@ -531,6 +624,11 @@ if ($resql)
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassSignature"), $langs->trans("ConfirmMassSignatureQuestion"), "sign", null, '', 0, 200, 500, 1); print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassSignature"), $langs->trans("ConfirmMassSignatureQuestion"), "sign", null, '', 0, 200, 500, 1);
} }
if ($massaction == 'nopresign')
{
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassNoSignature"), $langs->trans("ConfirmMassNoSignatureQuestion"), "nosign", null, '', 0, 200, 500, 1);
}
if ($sall) if ($sall)
{ {
foreach ($fieldstosearchall as $key => $val) $fieldstosearchall[$key] = $langs->trans($val); foreach ($fieldstosearchall as $key => $val) $fieldstosearchall[$key] = $langs->trans($val);
@ -1389,67 +1487,6 @@ if ($resql)
print $formfile->showdocuments('massfilesarea_proposals', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty); print $formfile->showdocuments('massfilesarea_proposals', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
if ($action == 'validate') {
if (GETPOST('confirm') == 'yes') {
$tmpproposal = new Propal($db);
$db->begin();
$error = 0;
foreach ($toselect as $checked) {
if ($tmpproposal->fetch($checked)) {
if ($tmpproposal->statut == 0) {
if ($tmpproposal->valid($user)) {
setEventMessage($tmpproposal->ref." ".$langs->trans('PassedInOpenStatus'), 'mesgs');
} else {
setEventMessage($langs->trans('CantBeValidated'), 'errors');
$error++;
}
} else {
setEventMessage($tmpproposal->ref." ".$langs->trans('IsNotADraft'), 'errors');
$error++;
}
}
dol_print_error($db);
$error++;
}
if ($error) {
$db->rollback();
} else {
$db->commit();
}
}
}
if ($action == "sign") {
if (GETPOST('confirm') == 'yes') {
$tmpproposal = new Propal($db);
$db->begin();
$error = 0;
foreach ($toselect as $checked) {
if ($tmpproposal->fetch($checked)) {
if ($tmpproposal->statut == 1) {
$tmpproposal->statut = 2;
if ($tmpproposal->update($user)) {
setEventMessage($tmpproposal->ref." ".$langs->trans('Signed'), 'mesgs');
} else {
dol_print_error($db);
$error++;
}
} else {
setEventMessage($tmpproposal->ref." ".$langs->trans('CantBeSign'), 'errors');
$error++;
}
} else {
dol_print_error($db);
$error++;
}
}
if ($error) {
$db->rollback();
} else {
$db->commit();
}
}
}
} else { } else {
dol_print_error($db); dol_print_error($db);
} }

View File

@ -70,7 +70,7 @@ if ($action == 'confirm_split' && GETPOST("confirm", "alpha") == 'yes')
$remid = (GETPOST("remid", 'int') ? GETPOST("remid", 'int') : 0); $remid = (GETPOST("remid", 'int') ? GETPOST("remid", 'int') : 0);
$discount = new DiscountAbsolute($db); $discount = new DiscountAbsolute($db);
$res = $discount->fetch($remid); $res = $discount->fetch($remid);
if (!$res > 0) if (!($res > 0))
{ {
$error++; $error++;
setEventMessages($langs->trans("ErrorFailedToLoadDiscount"), null, 'errors'); setEventMessages($langs->trans("ErrorFailedToLoadDiscount"), null, 'errors');

View File

@ -607,10 +607,10 @@ if (empty($reshook))
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
} elseif ($action == 'setremisepercent' && $usercancreate) { } elseif ($action == 'setremisepercent' && $usercancreate) {
$result = $object->set_remise($user, GETPOST('remise_percent')); $result = $object->set_remise($user, price2num(GETPOST('remise_percent'), 2));
} elseif ($action == 'setremiseabsolue' && $usercancreate) { } elseif ($action == 'setremiseabsolue' && $usercancreate) {
$result = $object->set_remise_absolue($user, GETPOST('remise_absolue')); $result = $object->set_remise_absolue($user, price2num(GETPOST('remise_absolue'), 'MU'));
} elseif ($action == 'addline' && GETPOST('submitforalllines', 'aZ09') && GETPOST('vatforalllines', 'alpha')) { } elseif ($action == 'addline' && GETPOST('submitforalllines', 'alpha') && GETPOST('vatforalllines', 'alpha')) {
// Define vat_rate // Define vat_rate
$vat_rate = (GETPOST('vatforalllines') ? GETPOST('vatforalllines') : 0); $vat_rate = (GETPOST('vatforalllines') ? GETPOST('vatforalllines') : 0);
$vat_rate = str_replace('*', '', $vat_rate); $vat_rate = str_replace('*', '', $vat_rate);
@ -640,7 +640,7 @@ if (empty($reshook))
} }
$qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS'); $qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS');
$remise_percent = (GETPOSTISSET('remise_percent'.$predef) ? price2num(GETPOST('remise_percent'.$predef, 'alpha')) : 0); $remise_percent = (GETPOSTISSET('remise_percent'.$predef) ? price2num(GETPOST('remise_percent'.$predef), 2) : 0);
// Extrafields // Extrafields
$extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line); $extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line);
@ -1032,7 +1032,7 @@ if (empty($reshook))
$label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : ''); $label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : '');
if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)) && ($price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent')) / 100) < price2num($price_min)))) { if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)) && ($price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent'), 2) / 100) < price2num($price_min)))) {
setEventMessages($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), null, 'errors'); setEventMessages($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), null, 'errors');
$error++; $error++;
} }
@ -1060,7 +1060,7 @@ if (empty($reshook))
} }
} }
} }
$result = $object->updateline(GETPOST('lineid'), $description, $pu_ht, GETPOST('qty'), GETPOST('remise_percent'), $vat_rate, $localtax1_rate, $localtax2_rate, 'HT', $info_bits, $date_start, $date_end, $type, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $special_code, $array_options, GETPOST('units'), $pu_ht_devise); $result = $object->updateline(GETPOST('lineid', 'int'), $description, $pu_ht, price2num(GETPOST('qty'), 'MS'), price2num(GETPOST('remise_percent'), 2), $vat_rate, $localtax1_rate, $localtax2_rate, 'HT', $info_bits, $date_start, $date_end, $type, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $special_code, $array_options, GETPOST('units'), $pu_ht_devise);
if ($result >= 0) { if ($result >= 0) {
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {

View File

@ -1821,6 +1821,8 @@ class Commande extends CommonOrder
$this->project = null; // Clear if another value was already set by fetch_projet $this->project = null; // Clear if another value was already set by fetch_projet
$this->statut = $obj->fk_statut; $this->statut = $obj->fk_statut;
$this->status = $obj->fk_statut;
$this->user_author_id = $obj->fk_user_author; $this->user_author_id = $obj->fk_user_author;
$this->user_valid = $obj->fk_user_valid; $this->user_valid = $obj->fk_user_valid;
$this->total_ht = $obj->total_ht; $this->total_ht = $obj->total_ht;

View File

@ -282,7 +282,7 @@ $help_url = "EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_P
// llxHeader('',$title,$help_url); // llxHeader('',$title,$help_url);
$sql = 'SELECT'; $sql = 'SELECT';
if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT'; if ($sall || $search_product_category > 0 || $search_user > 0) $sql = 'SELECT DISTINCT';
$sql .= ' s.rowid as socid, s.nom as name, s.name_alias as name_alias, s.email, s.town, s.zip, s.fk_pays, s.client, s.code_client,'; $sql .= ' s.rowid as socid, s.nom as name, s.name_alias as name_alias, s.email, s.town, s.zip, s.fk_pays, s.client, s.code_client,';
$sql .= " typent.code as typent_code,"; $sql .= " typent.code as typent_code,";
$sql .= " state.code_departement as state_code, state.nom as state_name,"; $sql .= " state.code_departement as state_code, state.nom as state_name,";

View File

@ -283,7 +283,7 @@ if ($mode == 'customer')
if ($mode == 'supplier') if ($mode == 'supplier')
{ {
$cat_type = Categorie::TYPE_SUPPLIER; $cat_type = Categorie::TYPE_SUPPLIER;
$cat_label = $langs->trans("Supplier").' '.lcfirst($langs->trans("Customer")); $cat_label = $langs->trans("Category").' '.lcfirst($langs->trans("Supplier"));
} }
print '<tr><td>'.$cat_label.'</td><td>'; print '<tr><td>'.$cat_label.'</td><td>';
print $formother->select_categories($cat_type, $categ_id, 'categ_id', true); print $formother->select_categories($cat_type, $categ_id, 'categ_id', true);

View File

@ -286,8 +286,9 @@ if (GETPOST('save') && !$cancel && $user->rights->banque->modifier)
$cat1 = GETPOST("cat1", 'alpha'); $cat1 = GETPOST("cat1", 'alpha');
$bankaccountid = $id; $bankaccountid = $id;
if (GETPOST('add_account', 'int') > 0) $bankaccountid = GETPOST('add_account', 'int'); if (GETPOST('add_account', 'int') > 0) {
$bankaccountid = GETPOST('add_account', 'int');
}
if (!$dateop) { if (!$dateop) {
$error++; $error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
@ -304,8 +305,7 @@ if (GETPOST('save') && !$cancel && $user->rights->banque->modifier)
$error++; $error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Amount")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Amount")), null, 'errors');
} }
if (!$bankaccountid > 0) if (!$bankaccountid > 0) {
{
$error++; $error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BankAccount")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BankAccount")), null, 'errors');
} }
@ -315,8 +315,7 @@ if (GETPOST('save') && !$cancel && $user->rights->banque->modifier)
$error++; $error++;
}*/ }*/
if (!$error && !empty($conf->global->BANK_USE_OLD_VARIOUS_PAYMENT)) if (!$error && !empty($conf->global->BANK_USE_OLD_VARIOUS_PAYMENT)) {
{
$objecttmp = new Account($db); $objecttmp = new Account($db);
$objecttmp->fetch($bankaccountid); $objecttmp->fetch($bankaccountid);
$insertid = $objecttmp->addline($dateop, $operation, $label, $amount, $num_chq, ($cat1 > 0 ? $cat1 : 0), $user, '', '', $search_accountancy_code); $insertid = $objecttmp->addline($dateop, $operation, $label, $amount, $num_chq, ($cat1 > 0 ? $cat1 : 0), $user, '', '', $search_accountancy_code);
@ -368,7 +367,7 @@ $donstatic = new Don($db);
$paymentstatic = new Paiement($db); $paymentstatic = new Paiement($db);
$paymentsupplierstatic = new PaiementFourn($db); $paymentsupplierstatic = new PaiementFourn($db);
$paymentscstatic = new PaymentSocialContribution($db); $paymentscstatic = new PaymentSocialContribution($db);
$paymentvatstatic = new TVA($db); $paymentvatstatic = new Tva($db);
$paymentsalstatic = new PaymentSalary($db); $paymentsalstatic = new PaymentSalary($db);
$paymentdonationstatic = new PaymentDonation($db); $paymentdonationstatic = new PaymentDonation($db);
$paymentvariousstatic = new PaymentVarious($db); $paymentvariousstatic = new PaymentVarious($db);

View File

@ -199,7 +199,7 @@ $chargestatic = new ChargeSociales($db);
$memberstatic = new Adherent($db); $memberstatic = new Adherent($db);
$paymentstatic = new Paiement($db); $paymentstatic = new Paiement($db);
$paymentsupplierstatic = new PaiementFourn($db); $paymentsupplierstatic = new PaiementFourn($db);
$paymentvatstatic = new TVA($db); $paymentvatstatic = new Tva($db);
$bankstatic = new Account($db); $bankstatic = new Account($db);
$banklinestatic = new AccountLine($db); $banklinestatic = new AccountLine($db);
$remisestatic = new RemiseCheque($db); $remisestatic = new RemiseCheque($db);

View File

@ -424,6 +424,10 @@ if ($result)
{ {
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
$variousstatic->id = $obj->rowid;
$variousstatic->ref = $obj->rowid;
$variousstatic->label = $obj->label;
print '<tr class="oddeven">'; print '<tr class="oddeven">';
// No // No
@ -433,15 +437,13 @@ if ($result)
// Ref // Ref
if ($arrayfields['ref']['checked']) { if ($arrayfields['ref']['checked']) {
$variousstatic->id = $obj->rowid; print '<td>'.$variousstatic->getNomUrl(1)."</td>";
$variousstatic->ref = $obj->rowid;
print "<td>".$variousstatic->getNomUrl(1)."</td>";
if (!$i) $totalarray['nbfield']++; if (!$i) $totalarray['nbfield']++;
} }
// Label payment // Label payment
if ($arrayfields['label']['checked']) { if ($arrayfields['label']['checked']) {
print "<td>".dol_trunc($obj->label, 40)."</td>"; print '<td class="tdoverflowmax150" title="'.$variousstatic->label.'">'.$variousstatic->label."</td>";
if (!$i) $totalarray['nbfield']++; if (!$i) $totalarray['nbfield']++;
} }
@ -460,7 +462,13 @@ if ($result)
// Type // Type
if ($arrayfields['type']['checked']) { if ($arrayfields['type']['checked']) {
print '<td>'.$langs->trans("PaymentTypeShort".$obj->payment_code).' '.$obj->num_payment.'</td>'; print '<td>';
if ($obj->payment_code) {
print $langs->trans("PaymentTypeShort".$obj->payment_code);
print ' ';
}
print $obj->num_payment;
print '</td>';
if (!$i) $totalarray['nbfield']++; if (!$i) $totalarray['nbfield']++;
} }

View File

@ -451,7 +451,7 @@ if (empty($reshook))
} }
$qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS'); $qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS');
$remise_percent = GETPOST('remise_percent'.$predef); $remise_percent = price2num(GETPOST('remise_percent'.$predef), 2);
// Extrafields // Extrafields
$extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line); $extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line);
@ -801,7 +801,7 @@ if (empty($reshook))
$label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : ''); $label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : '');
// Check price is not lower than minimum (check is done only for standard or replacement invoices) // Check price is not lower than minimum (check is done only for standard or replacement invoices)
if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)) && (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT) && $price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent')) / 100) < price2num($price_min)))) if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)) && (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT) && $price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent', 2)) / 100) < price2num($price_min))))
{ {
setEventMessages($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), null, 'errors'); setEventMessages($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), null, 'errors');
$error++; $error++;
@ -837,7 +837,7 @@ if (empty($reshook))
$localtax1_rate, $localtax1_rate,
$localtax1_rate, $localtax1_rate,
GETPOST('productid'), GETPOST('productid'),
GETPOST('remise_percent'), price2num(GETPOST('remise_percent'), 2),
'HT', 'HT',
$info_bits, $info_bits,
0, 0,
@ -923,7 +923,8 @@ if (empty($reshook))
* View * View
*/ */
llxHeader('', $langs->trans("RepeatableInvoices"), 'ch-facture.html#s-fac-facture-rec'); $help_url = '';
llxHeader('', $langs->trans("RepeatableInvoices"), $help_url);
$form = new Form($db); $form = new Form($db);
$formother = new FormOther($db); $formother = new FormOther($db);

View File

@ -476,19 +476,15 @@ if (empty($reshook))
} }
} }
} // Set incoterm } // Set incoterm
elseif ($action == 'set_incoterms' && !empty($conf->incoterm->enabled)) elseif ($action == 'set_incoterms' && !empty($conf->incoterm->enabled)) {
{
$result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha')); $result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha'));
} // bank account } // bank account
elseif ($action == 'setbankaccount' && $usercancreate) elseif ($action == 'setbankaccount' && $usercancreate) {
{
$result = $object->setBankAccount(GETPOST('fk_account', 'int')); $result = $object->setBankAccount(GETPOST('fk_account', 'int'));
} elseif ($action == 'setremisepercent' && $usercancreate) } elseif ($action == 'setremisepercent' && $usercancreate) {
{
$object->fetch($id); $object->fetch($id);
$result = $object->set_remise($user, $_POST['remise_percent']); $result = $object->set_remise($user, price2num(GETPOST('remise_percent'), 2));
} elseif ($action == "setabsolutediscount" && $usercancreate) } elseif ($action == "setabsolutediscount" && $usercancreate) {
{
// POST[remise_id] or POST[remise_id_for_payment] // POST[remise_id] or POST[remise_id_for_payment]
// We use the credit to reduce amount of invoice // We use the credit to reduce amount of invoice
@ -981,7 +977,7 @@ if (empty($reshook))
$error++; $error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
$action = 'create'; $action = 'create';
} elseif ($dateinvoice > (dol_now() + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { } elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
$error++; $error++;
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors'); setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
$action = 'create'; $action = 'create';
@ -993,26 +989,25 @@ if (empty($reshook))
$action = 'create'; $action = 'create';
} }
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']); $date_pointoftax = dol_mktime(12, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int'));
if (!$error) { if (!$error) {
// This is a replacement invoice // This is a replacement invoice
$result = $object->fetch($_POST['fac_replacement']); $result = $object->fetch(GETPOST('fac_replacement', 'int'));
$object->fetch_thirdparty(); $object->fetch_thirdparty();
$object->date = $dateinvoice; $object->date = $dateinvoice;
$object->date_pointoftax = $date_pointoftax; $object->date_pointoftax = $date_pointoftax;
$object->note_public = trim(GETPOST('note_public', 'restricthtml')); $object->note_public = trim(GETPOST('note_public', 'restricthtml'));
// We do not copy the private note // We do not copy the private note
$object->ref_client = $_POST['ref_client']; $object->ref_client = GETPOST('ref_client', 'alphanohtml');
$object->ref_int = $_POST['ref_int']; $object->model_pdf = GETPOST('model', 'alphanohtml');
$object->model_pdf = $_POST['model']; $object->fk_project = GETPOST('projectid', 'int');
$object->fk_project = $_POST['projectid']; $object->cond_reglement_id = GETPOST('cond_reglement_id', 'int');
$object->cond_reglement_id = $_POST['cond_reglement_id']; $object->mode_reglement_id = GETPOST('mode_reglement_id', 'int');
$object->mode_reglement_id = $_POST['mode_reglement_id'];
$object->fk_account = GETPOST('fk_account', 'int'); $object->fk_account = GETPOST('fk_account', 'int');
$object->remise_absolue = $_POST['remise_absolue']; $object->remise_absolue = price2num(GETPOST('remise_absolue'), 'MU');
$object->remise_percent = $_POST['remise_percent']; $object->remise_percent = price2num(GETPOST('remise_percent'), 2);
$object->fk_incoterms = GETPOST('incoterm_id', 'int'); $object->fk_incoterms = GETPOST('incoterm_id', 'int');
$object->location_incoterms = GETPOST('location_incoterms', 'alpha'); $object->location_incoterms = GETPOST('location_incoterms', 'alpha');
$object->multicurrency_code = GETPOST('multicurrency_code', 'alpha'); $object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
@ -1045,7 +1040,7 @@ if (empty($reshook))
$error++; $error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
$action = 'create'; $action = 'create';
} elseif ($dateinvoice > (dol_now() + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { } elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
$error++; $error++;
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors'); setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
$action = 'create'; $action = 'create';
@ -1067,11 +1062,11 @@ if (empty($reshook))
$object->ref_client = GETPOST('ref_client'); $object->ref_client = GETPOST('ref_client');
$object->model_pdf = GETPOST('model'); $object->model_pdf = GETPOST('model');
$object->fk_project = GETPOST('projectid', 'int'); $object->fk_project = GETPOST('projectid', 'int');
$object->cond_reglement_id = 0; $object->cond_reglement_id = 0; // No payment term for a credit note
$object->mode_reglement_id = GETPOST('mode_reglement_id'); $object->mode_reglement_id = GETPOST('mode_reglement_id', 'int');
$object->fk_account = GETPOST('fk_account', 'int'); $object->fk_account = GETPOST('fk_account', 'int');
$object->remise_absolue = GETPOST('remise_absolue'); $object->remise_absolue = price2num(GETPOST('remise_absolue'), 'MU');
$object->remise_percent = GETPOST('remise_percent'); $object->remise_percent = price2num(GETPOST('remise_percent'), 2);
$object->fk_incoterms = GETPOST('incoterm_id', 'int'); $object->fk_incoterms = GETPOST('incoterm_id', 'int');
$object->location_incoterms = GETPOST('location_incoterms', 'alpha'); $object->location_incoterms = GETPOST('location_incoterms', 'alpha');
$object->multicurrency_code = GETPOST('multicurrency_code', 'alpha'); $object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
@ -1265,7 +1260,7 @@ if (empty($reshook))
$error++; $error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
$action = 'create'; $action = 'create';
} elseif ($dateinvoice > (dol_now() + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { } elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
$error++; $error++;
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors'); setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
$action = 'create'; $action = 'create';
@ -1289,8 +1284,8 @@ if (empty($reshook))
$object->mode_reglement_id = GETPOST('mode_reglement_id', 'int'); $object->mode_reglement_id = GETPOST('mode_reglement_id', 'int');
$object->fk_account = GETPOST('fk_account', 'int'); $object->fk_account = GETPOST('fk_account', 'int');
$object->amount = price2num(GETPOST('amount')); $object->amount = price2num(GETPOST('amount'));
$object->remise_absolue = GETPOST('remise_absolue'); $object->remise_absolue = price2num(GETPOST('remise_absolue'), 'MU');
$object->remise_percent = GETPOST('remise_percent'); $object->remise_percent = price2num(GETPOST('remise_percent'), 2);
$object->fk_incoterms = GETPOST('incoterm_id', 'int'); $object->fk_incoterms = GETPOST('incoterm_id', 'int');
$object->location_incoterms = GETPOST('location_incoterms', 'alpha'); $object->location_incoterms = GETPOST('location_incoterms', 'alpha');
$object->multicurrency_code = GETPOST('multicurrency_code', 'alpha'); $object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
@ -1318,7 +1313,7 @@ if (empty($reshook))
$error++; $error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
$action = 'create'; $action = 'create';
} elseif ($dateinvoice > (dol_now() + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { } elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
$error++; $error++;
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors'); setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
$action = 'create'; $action = 'create';
@ -1343,8 +1338,8 @@ if (empty($reshook))
$object->mode_reglement_id = GETPOST('mode_reglement_id'); $object->mode_reglement_id = GETPOST('mode_reglement_id');
$object->fk_account = GETPOST('fk_account', 'int'); $object->fk_account = GETPOST('fk_account', 'int');
$object->amount = price2num(GETPOST('amount')); $object->amount = price2num(GETPOST('amount'));
$object->remise_absolue = GETPOST('remise_absolue'); $object->remise_absolue = price2num(GETPOST('remise_absolue'), 'MU');
$object->remise_percent = GETPOST('remise_percent'); $object->remise_percent = price2num(GETPOST('remise_percent'), 2);
$object->fk_incoterms = GETPOST('incoterm_id', 'int'); $object->fk_incoterms = GETPOST('incoterm_id', 'int');
$object->location_incoterms = GETPOST('location_incoterms', 'alpha'); $object->location_incoterms = GETPOST('location_incoterms', 'alpha');
$object->multicurrency_code = GETPOST('multicurrency_code', 'alpha'); $object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
@ -1742,7 +1737,7 @@ if (empty($reshook))
$error++; $error++;
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")); $mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date"));
setEventMessages($mesg, null, 'errors'); setEventMessages($mesg, null, 'errors');
} elseif ($dateinvoice > (dol_now() + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { } elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
$error++; $error++;
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors'); setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
$action = 'create'; $action = 'create';
@ -1837,8 +1832,8 @@ if (empty($reshook))
$object->fk_project = GETPOST('projectid', 'int'); $object->fk_project = GETPOST('projectid', 'int');
$object->cond_reglement_id = GETPOST('cond_reglement_id', 'int'); $object->cond_reglement_id = GETPOST('cond_reglement_id', 'int');
$object->mode_reglement_id = GETPOST('mode_reglement_id', 'int'); $object->mode_reglement_id = GETPOST('mode_reglement_id', 'int');
$object->remise_absolue = GETPOST('remise_absolue', 'int'); $object->remise_absolue =price2num(GETPOST('remise_absolue'), 'MU');
$object->remise_percent = GETPOST('remise_percent', 'int'); $object->remise_percent = price2num(GETPOST('remise_percent'), 2);
// Proprietes particulieres a facture de remplacement // Proprietes particulieres a facture de remplacement
@ -1923,8 +1918,8 @@ if (empty($reshook))
$tva_tx = ''; $tva_tx = '';
} }
$qty = GETPOST('qty'.$predef); $qty = price2num(GETPOST('qty'.$predef), 'MS');
$remise_percent = GETPOST('remise_percent'.$predef); $remise_percent = price2num(GETPOST('remise_percent'.$predef), 2);
// Extrafields // Extrafields
$extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line); $extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line);
@ -2314,7 +2309,7 @@ if (empty($reshook))
$label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : ''); $label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : '');
// Check price is not lower than minimum (check is done only for standard or replacement invoices) // Check price is not lower than minimum (check is done only for standard or replacement invoices)
if ($usercanproductignorepricemin && (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT) && $price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent')) / 100) < price2num($price_min)))) { if ($usercanproductignorepricemin && (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT) && $price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent'), 2) / 100) < price2num($price_min)))) {
setEventMessages($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), null, 'errors'); setEventMessages($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), null, 'errors');
$error++; $error++;
} }
@ -2367,7 +2362,7 @@ if (empty($reshook))
} }
} }
$result = $object->updateline(GETPOST('lineid', 'int'), $description, $pu_ht, $qty, price2num(GETPOST('remise_percent', 'alpha')), $result = $object->updateline(GETPOST('lineid', 'int'), $description, $pu_ht, $qty, price2num(GETPOST('remise_percent'), 2),
$date_start, $date_end, $vat_rate, $localtax1_rate, $localtax2_rate, 'HT', $info_bits, $type, $date_start, $date_end, $vat_rate, $localtax1_rate, $localtax2_rate, 'HT', $info_bits, $type,
GETPOST('fk_parent_line', 'int'), 0, $fournprice, $buyingprice, $label, $special_code, $array_options, price2num(GETPOST('progress', 'alpha')), GETPOST('fk_parent_line', 'int'), 0, $fournprice, $buyingprice, $label, $special_code, $array_options, price2num(GETPOST('progress', 'alpha')),
GETPOST('units', 'alpha'), $pu_ht_devise); GETPOST('units', 'alpha'), $pu_ht_devise);

View File

@ -1051,7 +1051,7 @@ class Invoices extends DolibarrApi
} }
if ($this->invoice->paye) { if ($this->invoice->paye) {
throw new RestException(500, 'Alreay payed'); throw new RestException(500, 'Alreay paid');
} }
$this->invoice->fetch($id); $this->invoice->fetch($id);

View File

@ -1165,6 +1165,7 @@ class Facture extends CommonInvoice
$object->id = 0; $object->id = 0;
$object->statut = self::STATUS_DRAFT; $object->statut = self::STATUS_DRAFT;
$object->status = self::STATUS_DRAFT;
// Clear fields // Clear fields
$object->date = (empty($this->date) ? dol_now() : $this->date); $object->date = (empty($this->date) ? dol_now() : $this->date);
@ -1191,23 +1192,23 @@ class Facture extends CommonInvoice
{ {
unset($object->lines[$i]); unset($object->lines[$i]);
} }
// Bloc to update dates of service (month by month only if previously filled at 1d near start or end of month)
// Bloc to update dates of service (month by month only if previously filled and similare to start and end of month)
// If it's a service with start and end dates // If it's a service with start and end dates
if (!empty($line->date_start) && !empty($line->date_end)) { if (!empty($conf->global->INVOICE_AUTO_NEXT_MONTH_ON_LINES) && !empty($line->date_start) && !empty($line->date_end)) {
// Get the dates // Get the dates
$start = dol_getdate($line->date_start); $start = dol_getdate($line->date_start);
$end = dol_getdate($line->date_end); $end = dol_getdate($line->date_end);
// Get the first and last day of the month // Get the first and last day of the month
$first = dol_get_first_day($start['year'], $start['mon']); $first = dol_get_first_day($start['year'], $start['mon']);
$last = dol_get_first_day($end['year'], $end['mon']); $last = dol_get_last_day($end['year'], $end['mon']);
// Get diff betweend start/end of month and previously filled //print dol_print_date(dol_mktime(0, 0, 0, $start['mon'], $start['mday'], $start['year'], 'gmt'), 'dayhour').' '.dol_print_date($first, 'dayhour').'<br>';
$diffFirst = num_between_day($first, dol_mktime($start['hours'], $start['minutes'], $start['seconds'], $start['mon'], $start['mday'], $start['year'], 'user')); //print dol_mktime(23, 59, 59, $end['mon'], $end['mday'], $end['year'], 'gmt').' '.$last.'<br>';exit;
$diffLast = num_between_day(dol_mktime($end['hours'], $end['minutes'], $end['seconds'], $end['mon'], $end['mday'], $end['year'], 'user'), $last); // If start date is first date of month and end date is last date of month
if (dol_mktime(0, 0, 0, $start['mon'], $start['mday'], $start['year'], 'gmt') == $first
// If there is <= 1d (or 2?) of start/or/end of month && dol_mktime(23, 59, 59, $end['mon'], $end['mday'], $end['year'], 'gmt') == $last) {
if ($diffFirst <= 2 && $diffLast <= 2) {
$nextMonth = dol_get_next_month($end['mon'], $end['year']); $nextMonth = dol_get_next_month($end['mon'], $end['year']);
$newFirst = dol_get_first_day($nextMonth['year'], $nextMonth['month']); $newFirst = dol_get_first_day($nextMonth['year'], $nextMonth['month']);
$newLast = dol_get_last_day($nextMonth['year'], $nextMonth['month']); $newLast = dol_get_last_day($nextMonth['year'], $nextMonth['month']);
@ -1594,6 +1595,8 @@ class Facture extends CommonInvoice
$this->project = null; // Clear if another value was already set by fetch_projet $this->project = null; // Clear if another value was already set by fetch_projet
$this->statut = $obj->fk_statut; $this->statut = $obj->fk_statut;
$this->status = $obj->fk_statut;
$this->date_lim_reglement = $this->db->jdate($obj->dlr); $this->date_lim_reglement = $this->db->jdate($obj->dlr);
$this->mode_reglement_id = $obj->fk_mode_reglement; $this->mode_reglement_id = $obj->fk_mode_reglement;
$this->mode_reglement_code = $obj->mode_reglement_code; $this->mode_reglement_code = $obj->mode_reglement_code;

View File

@ -416,7 +416,7 @@ $formcompany = new FormCompany($db);
$thirdpartystatic = new Societe($db); $thirdpartystatic = new Societe($db);
$sql = 'SELECT'; $sql = 'SELECT';
if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT'; if ($sall || $search_product_category > 0 || $search_user > 0) $sql = 'SELECT DISTINCT';
$sql .= ' f.rowid as id, f.ref, f.ref_client, f.type, f.note_private, f.note_public, f.increment, f.fk_mode_reglement, f.fk_cond_reglement, f.total as total_ht, f.tva as total_vat, f.total_ttc,'; $sql .= ' f.rowid as id, f.ref, f.ref_client, f.type, f.note_private, f.note_public, f.increment, f.fk_mode_reglement, f.fk_cond_reglement, f.total as total_ht, f.tva as total_vat, f.total_ttc,';
$sql .= ' f.localtax1 as total_localtax1, f.localtax2 as total_localtax2,'; $sql .= ' f.localtax1 as total_localtax1, f.localtax2 as total_localtax2,';
$sql .= ' f.fk_user_author,'; $sql .= ' f.fk_user_author,';

View File

@ -161,8 +161,9 @@ if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
$sql .= $hookmanager->resPrint; $sql .= $hookmanager->resPrint;
$sql .= " GROUP BY f.rowid, f.ref, f.datef, f.total, f.tva, f.total_ttc, f.ref_client, f.type, f.fk_statut, f.paye,"; $sql .= " GROUP BY f.rowid, f.ref, f.datef, f.total, f.tva, f.total_ttc, f.ref_client, f.type, f.fk_statut, f.paye,";
$sql .= " s.email, s.nom, s.rowid, s.code_client, s.code_compta, s.code_fournisseur, s.code_compta_fournisseur,"; $sql .= " s.nom, s.rowid, s.email, s.code_client, s.code_compta, s.code_fournisseur, s.code_compta_fournisseur,";
$sql .= " cc.rowid, cc.code"; $sql .= " cc.rowid, cc.code";
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", sc.fk_soc, sc.fk_user";
// Add Group from hooks // Add Group from hooks
$parameters = array(); $parameters = array();
@ -192,11 +193,19 @@ if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
$companystatic = new Societe($db); $companystatic = new Societe($db);
$i = 0; $i = 0;
$othernb = 0;
$tot_ttc = 0; $tot_ttc = 0;
while ($i < $num) while ($i < $num && $i < $conf->liste_limit)
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
if ($i >= $max) {
$othernb += 1;
$i++;
$tot_ttc += $obj->total_ttc;
continue;
}
$tmpinvoice->id = $obj->rowid; $tmpinvoice->id = $obj->rowid;
$tmpinvoice->ref = $obj->ref; $tmpinvoice->ref = $obj->ref;
$tmpinvoice->date = $db->jdate($obj->date); $tmpinvoice->date = $db->jdate($obj->date);
@ -231,6 +240,14 @@ if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
$i++; $i++;
} }
if ($othernb) {
print '<tr class="oddeven">';
print '<td class="nowrap" colspan="3">';
print '<span class="opacitymedium">'.$langs->trans("More").'... ('.$othernb.')</span>';
print '</td>';
print "</tr>\n";
}
print '<tr class="liste_total"><td class="left">'.$langs->trans("Total").'</td>'; print '<tr class="liste_total"><td class="left">'.$langs->trans("Total").'</td>';
print '<td colspan="2" class="right">'.price($tot_ttc).'</td>'; print '<td colspan="2" class="right">'.price($tot_ttc).'</td>';
print '</tr>'; print '</tr>';
@ -289,11 +306,19 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU
$companystatic = new Societe($db); $companystatic = new Societe($db);
$i = 0; $i = 0;
$othernb = 0;
$tot_ttc = 0; $tot_ttc = 0;
while ($i < $num) while ($i < $num && $i < $conf->liste_limit)
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
if ($i >= $max) {
$othernb += 1;
$i++;
$tot_ttc += $obj->total_ttc;
continue;
}
$facturesupplierstatic->ref = $obj->ref; $facturesupplierstatic->ref = $obj->ref;
$facturesupplierstatic->id = $obj->rowid; $facturesupplierstatic->id = $obj->rowid;
$facturesupplierstatic->total_ht = $obj->total_ht; $facturesupplierstatic->total_ht = $obj->total_ht;
@ -327,6 +352,14 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU
$i++; $i++;
} }
if ($othernb) {
print '<tr class="oddeven">';
print '<td class="nowrap" colspan="3">';
print '<span class="opacitymedium">'.$langs->trans("More").'... ('.$othernb.')</span>';
print '</td>';
print "</tr>\n";
}
print '<tr class="liste_total"><td class="left">'.$langs->trans("Total").'</td>'; print '<tr class="liste_total"><td class="left">'.$langs->trans("Total").'</td>';
print '<td colspan="2" class="right">'.price($tot_ttc).'</td>'; print '<td colspan="2" class="right">'.price($tot_ttc).'</td>';
print '</tr>'; print '</tr>';
@ -1089,7 +1122,7 @@ if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
} }
/* /*
* Unpayed supplier invoices * Unpaid supplier invoices
*/ */
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_invoice->enabled)) && $user->rights->fournisseur->facture->lire) if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_invoice->enabled)) && $user->rights->fournisseur->facture->lire)
{ {

View File

@ -381,7 +381,7 @@ class Localtax extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* localtax payed * Total of localtax paid in invoice
* *
* @param int $year Year * @param int $year Year
* @return int ??? * @return int ???
@ -419,8 +419,7 @@ class Localtax extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* localtax payed * Total of localtax paid
* Total de la localtax payed
* *
* @param int $year Year * @param int $year Year
* @return int ??? * @return int ???

View File

@ -565,7 +565,7 @@ print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
/* /*
* Payed * Paid
*/ */
print load_fiche_titre($langs->transcountry($LTPaid, $mysoc->country_code), '', ''); print load_fiche_titre($langs->transcountry($LTPaid, $mysoc->country_code), '', '');

View File

@ -265,10 +265,8 @@ print '</td></tr>';
// Bank account // Bank account
if (!empty($conf->banque->enabled)) if (!empty($conf->banque->enabled))
{ {
if ($object->fk_account > 0) if ($object->fk_account > 0) {
{ if ($object->type_code == 'CHQ' && $bankline->fk_bordereau > 0) {
if ($object->type_code == 'CHQ' && $bankline->fk_bordereau > 0)
{
dol_include_once('/compta/paiement/cheque/class/remisecheque.class.php'); dol_include_once('/compta/paiement/cheque/class/remisecheque.class.php');
$bordereau = new RemiseCheque($db); $bordereau = new RemiseCheque($db);
$bordereau->fetch($bankline->fk_bordereau); $bordereau->fetch($bankline->fk_bordereau);
@ -285,7 +283,12 @@ if (!empty($conf->banque->enabled))
print '<tr>'; print '<tr>';
print '<td>'.$langs->trans('BankTransactionLine').'</td>'; print '<td>'.$langs->trans('BankTransactionLine').'</td>';
print '<td>'; print '<td>';
print $bankline->getNomUrl(1, 0, 'showconciliatedandaccounted'); if ($object->fk_account > 0) {
print $bankline->getNomUrl(1, 0, 'showconciliatedandaccounted');
} else {
$langs->load("admin");
print '<span class="opacitymedium">'.$langs->trans("NoRecordFoundIBankcAccount", $langs->transnoentitiesnoconv("Module85Name")).'</span>';
}
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
} }

View File

@ -162,7 +162,7 @@ print dol_get_fiche_end();
/* /*
* List of social contributions payed * List of social contributions paid
*/ */
$disable_delete = 0; $disable_delete = 0;
@ -213,7 +213,7 @@ if ($resql)
print '<td class="right">'.price($objp->sc_amount).'</td>'; print '<td class="right">'.price($objp->sc_amount).'</td>';
// Status // Status
print '<td class="center">'.$socialcontrib->getLibStatut(4, $objp->amount).'</td>'; print '<td class="center">'.$socialcontrib->getLibStatut(4, $objp->amount).'</td>';
// Amount payed // Amount paid
print '<td class="right">'.price($objp->amount).'</td>'; print '<td class="right">'.price($objp->amount).'</td>';
print "</tr>\n"; print "</tr>\n";
if ($objp->paye == 1) // If at least one invoice is paid, disable delete if ($objp->paye == 1) // If at least one invoice is paid, disable delete

View File

@ -371,7 +371,7 @@ class BonPrelevement extends CommonObject
$num = count($facs); $num = count($facs);
for ($i = 0; $i < $num; $i++) for ($i = 0; $i < $num; $i++)
{ {
/* Tag invoice as payed */ /* Tag invoice as paid */
dol_syslog(get_class($this)."::set_credite set_paid fac ".$facs[$i]); dol_syslog(get_class($this)."::set_credite set_paid fac ".$facs[$i]);
$fac = new Facture($this->db); $fac = new Facture($this->db);
$fac->fetch($facs[$i]); $fac->fetch($facs[$i]);
@ -1704,7 +1704,7 @@ class BonPrelevement extends CommonObject
fputs($this->file, ' <Id>'.$CrLf); fputs($this->file, ' <Id>'.$CrLf);
fputs($this->file, ' <PrvtId>'.$CrLf); fputs($this->file, ' <PrvtId>'.$CrLf);
fputs($this->file, ' <Othr>'.$CrLf); fputs($this->file, ' <Othr>'.$CrLf);
fputs($this->file, ' <Id>'.$conf->global->PAYMENTBYBANKTRANSFER_ICS.'</Id>'.$CrLf); fputs($this->file, ' <Id>'.$this->emetteur_ics.'</Id>'.$CrLf);
fputs($this->file, ' </Othr>'.$CrLf); fputs($this->file, ' </Othr>'.$CrLf);
fputs($this->file, ' </PrvtId>'.$CrLf); fputs($this->file, ' </PrvtId>'.$CrLf);
fputs($this->file, ' </Id>'.$CrLf); fputs($this->file, ' </Id>'.$CrLf);

View File

@ -3,6 +3,7 @@
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2005-2013 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2016-2018 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2016-2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2017 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -28,10 +29,13 @@ require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/paymentsocialcontribution.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/paymentsocialcontribution.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formsocialcontrib.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formsocialcontrib.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
if (!empty($conf->projet->enabled)) { require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
if (!empty($conf->projet->enabled))
{
include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
} }
@ -40,7 +44,7 @@ if (!empty($conf->accounting->enabled)) {
} }
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array('compta', 'bills', 'banks')); $langs->loadLangs(array('compta', 'bills', 'banks', 'hrm'));
$id = GETPOST('id', 'int'); $id = GETPOST('id', 'int');
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
@ -51,6 +55,7 @@ $dateech = dol_mktime(GETPOST('echhour'), GETPOST('echmin'), GETPOST('echsec'),
$dateperiod = dol_mktime(GETPOST('periodhour'), GETPOST('periodmin'), GETPOST('periodsec'), GETPOST('periodmonth'), GETPOST('periodday'), GETPOST('periodyear')); $dateperiod = dol_mktime(GETPOST('periodhour'), GETPOST('periodmin'), GETPOST('periodsec'), GETPOST('periodmonth'), GETPOST('periodday'), GETPOST('periodyear'));
$label = GETPOST('label', 'alpha'); $label = GETPOST('label', 'alpha');
$actioncode = GETPOST('actioncode'); $actioncode = GETPOST('actioncode');
$fk_user = GETPOST('userid', 'int');
// Security check // Security check
$socid = GETPOST('socid', 'int'); $socid = GETPOST('socid', 'int');
@ -94,6 +99,12 @@ if ($action == 'classin' && $user->rights->tax->charges->creer)
$object->setProject(GETPOST('projectid')); $object->setProject(GETPOST('projectid'));
} }
if ($action == 'setfk_user' && $user->rights->tax->charges->creer) {
$object->fetch($id);
$object->fk_user = $fk_user;
$object->update($user);
}
if ($action == 'setlib' && $user->rights->tax->charges->creer) if ($action == 'setlib' && $user->rights->tax->charges->creer)
{ {
$object->fetch($id); $object->fetch($id);
@ -163,6 +174,7 @@ if ($action == 'add' && $user->rights->tax->charges->creer)
$object->date_ech = $dateech; $object->date_ech = $dateech;
$object->periode = $dateperiod; $object->periode = $dateperiod;
$object->amount = $amount; $object->amount = $amount;
$object->fk_user = $fk_user;
$object->mode_reglement_id = (int) GETPOST('mode_reglement_id', 'int'); $object->mode_reglement_id = (int) GETPOST('mode_reglement_id', 'int');
$object->fk_account = (int) GETPOST('fk_account', 'int'); $object->fk_account = (int) GETPOST('fk_account', 'int');
$object->fk_project = (int) GETPOST('fk_project', 'int'); $object->fk_project = (int) GETPOST('fk_project', 'int');
@ -202,6 +214,7 @@ if ($action == 'update' && !$_POST["cancel"] && $user->rights->tax->charges->cre
$object->date_ech = $dateech; $object->date_ech = $dateech;
$object->periode = $dateperiod; $object->periode = $dateperiod;
$object->amount = $amount; $object->amount = $amount;
$object->fk_user = $fk_user;
$result = $object->update($user); $result = $object->update($user);
if ($result <= 0) { if ($result <= 0) {
@ -342,6 +355,12 @@ if ($action == 'create')
print '<td><input type="text" size="6" name="amount" class="flat" value="'.dol_escape_htmltag(GETPOST('amount', 'alpha')).'"></td>'; print '<td><input type="text" size="6" name="amount" class="flat" value="'.dol_escape_htmltag(GETPOST('amount', 'alpha')).'"></td>';
print '</tr>'; print '</tr>';
// Employee
print '<tr><td>';
print $langs->trans('Employee');
print '</td>';
print '<td>'.$form->select_dolusers($fk_user, 'userid', 1).'</td></tr>';
// Project // Project
if (!empty($conf->projet->enabled)) if (!empty($conf->projet->enabled))
{ {
@ -442,6 +461,26 @@ if ($id > 0)
// Ref customer // Ref customer
$morehtmlref .= $form->editfieldkey("Label", 'lib', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', 0, 1); $morehtmlref .= $form->editfieldkey("Label", 'lib', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', 0, 1);
$morehtmlref .= $form->editfieldval("Label", 'lib', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', null, null, '', 1); $morehtmlref .= $form->editfieldval("Label", 'lib', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', null, null, '', 1);
// Employee
if ($action != 'editfk_user') {
$morehtmlref .= '<br>' . $form->editfieldkey("Employee", 'fk_user', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', 0, 1);
if (!empty($object->fk_user)) {
$userstatic = new User($db);
$userstatic->fetch($object->fk_user);
$morehtmlref .= $userstatic->getNomUrl(1);
}
} else {
$morehtmlref .= '<br>'.$langs->trans('Employee').' :&nbsp;';
$morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref .= '<input type="hidden" name="action" value="setfk_user">';
$morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
$morehtmlref .= $form->select_dolusers($object->fk_user, 'userid', 1);
$morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
$morehtmlref .= '</form>';
}
// Project // Project
if (!empty($conf->projet->enabled)) if (!empty($conf->projet->enabled))
{ {

View File

@ -46,9 +46,15 @@ class Cchargesociales
/** /**
* @var string Label * @var string Label
* @deprecated
*/ */
public $libelle; public $libelle;
/**
* @var string Label
*/
public $label;
public $deductible; public $deductible;
public $active; public $active;
public $code; public $code;
@ -107,7 +113,6 @@ class Cchargesociales
// Insert request // Insert request
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.$this->table_element.'('; $sql = 'INSERT INTO '.MAIN_DB_PREFIX.$this->table_element.'(';
$sql .= 'libelle,'; $sql .= 'libelle,';
$sql .= 'deductible,'; $sql .= 'deductible,';
$sql .= 'active,'; $sql .= 'active,';
@ -115,10 +120,7 @@ class Cchargesociales
$sql .= 'fk_pays,'; $sql .= 'fk_pays,';
$sql .= 'module'; $sql .= 'module';
$sql .= 'accountancy_code'; $sql .= 'accountancy_code';
$sql .= ') VALUES ('; $sql .= ') VALUES (';
$sql .= ' '.(!isset($this->libelle) ? 'NULL' : "'".$this->db->escape($this->libelle)."'").','; $sql .= ' '.(!isset($this->libelle) ? 'NULL' : "'".$this->db->escape($this->libelle)."'").',';
$sql .= ' '.(!isset($this->deductible) ? 'NULL' : $this->deductible).','; $sql .= ' '.(!isset($this->deductible) ? 'NULL' : $this->deductible).',';
$sql .= ' '.(!isset($this->active) ? 'NULL' : $this->active).','; $sql .= ' '.(!isset($this->active) ? 'NULL' : $this->active).',';
@ -126,8 +128,6 @@ class Cchargesociales
$sql .= ' '.(!isset($this->fk_pays) ? 'NULL' : $this->fk_pays).','; $sql .= ' '.(!isset($this->fk_pays) ? 'NULL' : $this->fk_pays).',';
$sql .= ' '.(!isset($this->module) ? 'NULL' : "'".$this->db->escape($this->module)."'").','; $sql .= ' '.(!isset($this->module) ? 'NULL' : "'".$this->db->escape($this->module)."'").',';
$sql .= ' '.(!isset($this->accountancy_code) ? 'NULL' : "'".$this->db->escape($this->accountancy_code)."'"); $sql .= ' '.(!isset($this->accountancy_code) ? 'NULL' : "'".$this->db->escape($this->accountancy_code)."'");
$sql .= ')'; $sql .= ')';
$this->db->begin(); $this->db->begin();
@ -179,7 +179,7 @@ class Cchargesociales
$sql = 'SELECT'; $sql = 'SELECT';
$sql .= " t.id,"; $sql .= " t.id,";
$sql .= " t.libelle,"; $sql .= " t.libelle as label,";
$sql .= " t.deductible,"; $sql .= " t.deductible,";
$sql .= " t.active,"; $sql .= " t.active,";
$sql .= " t.code,"; $sql .= " t.code,";
@ -201,7 +201,8 @@ class Cchargesociales
$this->id = $obj->id; $this->id = $obj->id;
$this->libelle = $obj->libelle; $this->libelle = $obj->label;
$this->label = $obj->label;
$this->deductible = $obj->deductible; $this->deductible = $obj->deductible;
$this->active = $obj->active; $this->active = $obj->active;
$this->code = $obj->code; $this->code = $obj->code;
@ -501,6 +502,7 @@ class Cchargesociales
$this->id = 0; $this->id = 0;
$this->libelle = ''; $this->libelle = '';
$this->label = '';
$this->deductible = ''; $this->deductible = '';
$this->active = ''; $this->active = '';
$this->code = ''; $this->code = '';

View File

@ -3,6 +3,7 @@
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2016-2020 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2016-2020 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2017 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -107,6 +108,11 @@ class ChargeSociales extends CommonObject
*/ */
public $fk_project; public $fk_project;
/**
* @var int ID
*/
public $fk_user;
const STATUS_UNPAID = 0; const STATUS_UNPAID = 0;
const STATUS_PAID = 1; const STATUS_PAID = 1;
@ -133,8 +139,8 @@ class ChargeSociales extends CommonObject
{ {
$sql = "SELECT cs.rowid, cs.date_ech"; $sql = "SELECT cs.rowid, cs.date_ech";
$sql .= ", cs.libelle as label, cs.fk_type, cs.amount, cs.fk_projet as fk_project, cs.paye, cs.periode, cs.import_key"; $sql .= ", cs.libelle as label, cs.fk_type, cs.amount, cs.fk_projet as fk_project, cs.paye, cs.periode, cs.import_key";
$sql .= ", cs.fk_account, cs.fk_mode_reglement"; $sql .= ", cs.fk_account, cs.fk_mode_reglement, cs.fk_user";
$sql .= ", c.libelle"; $sql .= ", c.libelle as type_label";
$sql .= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle'; $sql .= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle';
$sql .= " FROM ".MAIN_DB_PREFIX."chargesociales as cs"; $sql .= " FROM ".MAIN_DB_PREFIX."chargesociales as cs";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_chargesociales as c ON cs.fk_type = c.id"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_chargesociales as c ON cs.fk_type = c.id";
@ -157,13 +163,14 @@ class ChargeSociales extends CommonObject
$this->lib = $obj->label; $this->lib = $obj->label;
$this->label = $obj->label; $this->label = $obj->label;
$this->type = $obj->fk_type; $this->type = $obj->fk_type;
$this->type_label = $obj->libelle; $this->type_label = $obj->type_label;
$this->fk_account = $obj->fk_account; $this->fk_account = $obj->fk_account;
$this->mode_reglement_id = $obj->fk_mode_reglement; $this->mode_reglement_id = $obj->fk_mode_reglement;
$this->mode_reglement_code = $obj->mode_reglement_code; $this->mode_reglement_code = $obj->mode_reglement_code;
$this->mode_reglement = $obj->mode_reglement_libelle; $this->mode_reglement = $obj->mode_reglement_libelle;
$this->amount = $obj->amount; $this->amount = $obj->amount;
$this->fk_project = $obj->fk_project; $this->fk_project = $obj->fk_project;
$this->fk_user = $obj->fk_user;
$this->paye = $obj->paye; $this->paye = $obj->paye;
$this->periode = $this->db->jdate($obj->periode); $this->periode = $this->db->jdate($obj->periode);
$this->import_key = $this->import_key; $this->import_key = $this->import_key;
@ -222,7 +229,7 @@ class ChargeSociales extends CommonObject
$this->db->begin(); $this->db->begin();
$sql = "INSERT INTO ".MAIN_DB_PREFIX."chargesociales (fk_type, fk_account, fk_mode_reglement, libelle, date_ech, periode, amount, fk_projet, entity, fk_user_author, date_creation)"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."chargesociales (fk_type, fk_account, fk_mode_reglement, libelle, date_ech, periode, amount, fk_projet, entity, fk_user_author, fk_user, date_creation)";
$sql .= " VALUES (".$this->type; $sql .= " VALUES (".$this->type;
$sql .= ", ".($this->fk_account > 0 ? $this->fk_account : 'NULL'); $sql .= ", ".($this->fk_account > 0 ? $this->fk_account : 'NULL');
$sql .= ", ".($this->mode_reglement_id > 0 ? $this->mode_reglement_id : "NULL"); $sql .= ", ".($this->mode_reglement_id > 0 ? $this->mode_reglement_id : "NULL");
@ -233,6 +240,7 @@ class ChargeSociales extends CommonObject
$sql .= ", ".($this->fk_project > 0 ? $this->fk_project : 'NULL'); $sql .= ", ".($this->fk_project > 0 ? $this->fk_project : 'NULL');
$sql .= ", ".$conf->entity; $sql .= ", ".$conf->entity;
$sql .= ", ".$user->id; $sql .= ", ".$user->id;
$sql .= ", ".($this->fk_user > 0 ? $this->db->escape($this->fk_user) : 'NULL');
$sql .= ", '".$this->db->idate($now)."'"; $sql .= ", '".$this->db->idate($now)."'";
$sql .= ")"; $sql .= ")";
@ -346,6 +354,7 @@ class ChargeSociales extends CommonObject
$sql .= ", periode='".$this->db->idate($this->periode)."'"; $sql .= ", periode='".$this->db->idate($this->periode)."'";
$sql .= ", amount='".price2num($this->amount, 'MT')."'"; $sql .= ", amount='".price2num($this->amount, 'MT')."'";
$sql .= ", fk_projet=".($this->fk_project > 0 ? $this->db->escape($this->fk_project) : "NULL"); $sql .= ", fk_projet=".($this->fk_project > 0 ? $this->db->escape($this->fk_project) : "NULL");
$sql .= ", fk_user=".($this->fk_user > 0 ? $this->db->escape($this->fk_user) : "NULL");
$sql .= ", fk_user_modif=".$user->id; $sql .= ", fk_user_modif=".$user->id;
$sql .= " WHERE rowid=".$this->id; $sql .= " WHERE rowid=".$this->id;
@ -421,7 +430,7 @@ class ChargeSociales extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Tag social contribution as payed completely * Tag social contribution as paid completely
* *
* @param User $user Object user making change * @param User $user Object user making change
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
@ -439,7 +448,7 @@ class ChargeSociales extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Remove tag payed on social contribution * Remove tag paid on social contribution
* *
* @param User $user Object user making change * @param User $user Object user making change
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
@ -459,7 +468,7 @@ class ChargeSociales extends CommonObject
* Retourne le libelle du statut d'une charge (impaye, payee) * Retourne le libelle du statut d'une charge (impaye, payee)
* *
* @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 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) * @param double $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount paid if you have it, 1 otherwise)
* @return string Label * @return string Label
*/ */
public function getLibStatut($mode = 0, $alreadypaid = -1) public function getLibStatut($mode = 0, $alreadypaid = -1)
@ -473,7 +482,7 @@ class ChargeSociales extends CommonObject
* *
* @param int $status Id 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 * @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) * @param double $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount paid if you have it, 1 otherwise)
* @return string Label * @return string Label
*/ */
public function LibStatut($status, $mode = 0, $alreadypaid = -1) public function LibStatut($status, $mode = 0, $alreadypaid = -1)

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