diff --git a/ChangeLog b/ChangeLog index 647030db6eb..2c00bda48f3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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 ***** For users: @@ -181,8 +199,7 @@ NEW: add option "If the feature to manage kits of module Stock is used, show det For developers: --------------- -NEW: add substitution key __MEMBER_TYPE__ -NEW: add substitution key __TYPE__ +NEW: add __MEMBER_TYPE__ and __TYPE__ substitution key 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: 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: can use dynamic code into the 'enabled' property of DAO fields 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: retrieve discount from invoice from API 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: add incoterms data into the substitution array 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 thirdparty by barcode 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: get state by REST API -NEW: get state dictionary by REST API -NEW: improve Product API for product variants +NEW: get state dictionnary by REST API +NEW: improve Product API for variant products +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 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 * 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. -* 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. * 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. @@ -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. * 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) -* 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 ***** FIX: make formConfirm an addreplace-type hook diff --git a/build/debian/control b/build/debian/control index 0ef5367072f..eed54669555 100755 --- a/build/debian/control +++ b/build/debian/control @@ -4,7 +4,7 @@ Priority: optional Maintainer: Laurent Destailleur (eldy) # Uploaders: Laurent Destailleur (eldy) # Only if differs from Maintainer Standards-Version: 3.9.6 -Homepage: http://www.dolibarr.org +Homepage: https://www.dolibarr.org Build-Depends: debhelper (>= 9), po-debconf # This package need at least debian 7 or ubuntu 13.04 or any distribution based on this version diff --git a/build/debian/dolibarr.postinst b/build/debian/dolibarr.postinst index 7684d02ff3d..26a08a55826 100644 --- a/build/debian/dolibarr.postinst +++ b/build/debian/dolibarr.postinst @@ -23,7 +23,7 @@ setup_empty_conf() { mkdir -p /etc/dolibarr touch /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() { diff --git a/build/generate_filelist_xml.php b/build/generate_filelist_xml.php index 41c20740d78..50eb6c84def 100755 --- a/build/generate_filelist_xml.php +++ b/build/generate_filelist_xml.php @@ -105,8 +105,8 @@ if (empty($includecustom)) { } } -print "Release : ".$release."\n"; print "Working on files into : ".DOL_DOCUMENT_ROOT."\n"; +print "Release : ".$release."\n"; print "Include custom in signature : ".$includecustom."\n"; print "Include constants in signature : "; foreach ($includeconstants as $countrycode => $tmp) { diff --git a/htdocs/accountancy/admin/accountmodel.php b/htdocs/accountancy/admin/accountmodel.php index 6d621a7e101..3c3489185f4 100644 --- a/htdocs/accountancy/admin/accountmodel.php +++ b/htdocs/accountancy/admin/accountmodel.php @@ -444,9 +444,6 @@ if ($id) // Form to add a new line if ($tabname[$id]) { - $alabelisused = 0; - $var = false; - $fieldlist = explode(',', $tabfield[$id]); // Line for title @@ -481,7 +478,6 @@ if ($id) } print ''; } - if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') $alabelisused = 1; } print ''; @@ -612,7 +608,7 @@ if ($id) print ' '; } else { $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 $error = $hookmanager->error; $errors = $hookmanager->errors; diff --git a/htdocs/accountancy/admin/card.php b/htdocs/accountancy/admin/card.php index c905ad25cd0..23ebde7e230 100644 --- a/htdocs/accountancy/admin/card.php +++ b/htdocs/accountancy/admin/card.php @@ -76,7 +76,7 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Label")), null, 'errors'); $action = 'create'; } 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); $result = $db->query($sql); diff --git a/htdocs/accountancy/admin/categories_list.php b/htdocs/accountancy/admin/categories_list.php index 53dfb1cd5f9..e3a39c5d8b1 100644 --- a/htdocs/accountancy/admin/categories_list.php +++ b/htdocs/accountancy/admin/categories_list.php @@ -438,8 +438,6 @@ if ($id) // Form to add a new line if ($tabname[$id]) { - $alabelisused = 0; - $fieldlist = explode(',', $tabfield[$id]); // Line for title @@ -496,7 +494,6 @@ if ($id) else print $valuetoshow; print ''; } - if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') $alabelisused = 1; } print ''; diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php index ae36f0f7fa6..a7bf28d9091 100644 --- a/htdocs/accountancy/admin/index.php +++ b/htdocs/accountancy/admin/index.php @@ -100,7 +100,7 @@ if ($action == 'update') { if ($action == 'setlistsorttodo') { $setlistsorttodo = GETPOST('value', 'int'); $res = dolibarr_set_const($db, "ACCOUNTING_LIST_SORT_VENTILATION_TODO", $setlistsorttodo, 'yesno', 0, '', $conf->entity); - if (!$res > 0) { + if (!($res > 0)) { $error++; } @@ -114,9 +114,10 @@ if ($action == 'setlistsorttodo') { if ($action == 'setlistsortdone') { $setlistsortdone = GETPOST('value', 'int'); $res = dolibarr_set_const($db, "ACCOUNTING_LIST_SORT_VENTILATION_DONE", $setlistsortdone, 'yesno', 0, '', $conf->entity); - if (!$res > 0) { + if (!($res > 0)) { $error++; } + if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { @@ -127,9 +128,10 @@ if ($action == 'setlistsortdone') { if ($action == 'setmanagezero') { $setmanagezero = GETPOST('value', 'int'); $res = dolibarr_set_const($db, "ACCOUNTING_MANAGE_ZERO", $setmanagezero, 'yesno', 0, '', $conf->entity); - if (!$res > 0) { + if (!($res > 0)) { $error++; } + if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { @@ -140,9 +142,10 @@ if ($action == 'setmanagezero') { if ($action == 'setdisabledirectinput') { $setdisabledirectinput = GETPOST('value', 'int'); $res = dolibarr_set_const($db, "BANK_DISABLE_DIRECT_INPUT", $setdisabledirectinput, 'yesno', 0, '', $conf->entity); - if (!$res > 0) { + if (!($res > 0)) { $error++; } + if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { @@ -153,9 +156,10 @@ if ($action == 'setdisabledirectinput') { if ($action == 'setenabledraftexport') { $setenabledraftexport = GETPOST('value', 'int'); $res = dolibarr_set_const($db, "ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL", $setenabledraftexport, 'yesno', 0, '', $conf->entity); - if (!$res > 0) { + if (!($res > 0)) { $error++; } + if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { @@ -166,9 +170,10 @@ if ($action == 'setenabledraftexport') { if ($action == 'setenablesubsidiarylist') { $setenablesubsidiarylist = GETPOST('value', 'int'); $res = dolibarr_set_const($db, "ACCOUNTANCY_COMBO_FOR_AUX", $setenablesubsidiarylist, 'yesno', 0, '', $conf->entity); - if (!$res > 0) { + if (!($res > 0)) { $error++; } + if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { @@ -179,9 +184,10 @@ if ($action == 'setenablesubsidiarylist') { if ($action == 'setdisablebindingonsales') { $setdisablebindingonsales = GETPOST('value', 'int'); $res = dolibarr_set_const($db, "ACCOUNTING_DISABLE_BINDING_ON_SALES", $setdisablebindingonsales, 'yesno', 0, '', $conf->entity); - if (!$res > 0) { + if (!($res > 0)) { $error++; } + if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { @@ -192,9 +198,10 @@ if ($action == 'setdisablebindingonsales') { if ($action == 'setdisablebindingonpurchases') { $setdisablebindingonpurchases = GETPOST('value', 'int'); $res = dolibarr_set_const($db, "ACCOUNTING_DISABLE_BINDING_ON_PURCHASES", $setdisablebindingonpurchases, 'yesno', 0, '', $conf->entity); - if (!$res > 0) { + if (!($res > 0)) { $error++; } + if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { @@ -205,9 +212,10 @@ if ($action == 'setdisablebindingonpurchases') { if ($action == 'setdisablebindingonexpensereports') { $setdisablebindingonexpensereports = GETPOST('value', 'int'); $res = dolibarr_set_const($db, "ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS", $setdisablebindingonexpensereports, 'yesno', 0, '', $conf->entity); - if (!$res > 0) { + if (!($res > 0)) { $error++; } + if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { @@ -215,9 +223,11 @@ if ($action == 'setdisablebindingonexpensereports') { } } + /* * View */ + $form = new Form($db); $title = $langs->trans('ConfigAccountingExpert'); diff --git a/htdocs/accountancy/admin/journals_list.php b/htdocs/accountancy/admin/journals_list.php index bb192f0a693..1d3e8bccdd7 100644 --- a/htdocs/accountancy/admin/journals_list.php +++ b/htdocs/accountancy/admin/journals_list.php @@ -407,8 +407,6 @@ if ($id) // Form to add a new line if ($tabname[$id]) { - $alabelisused = 0; - $fieldlist = explode(',', $tabfield[$id]); // Line for title @@ -437,7 +435,6 @@ if ($id) else print $valuetoshow; print ''; } - if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') $alabelisused = 1; } print ''; diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index fcd7efdab47..de60bd09897 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -16,7 +16,6 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * */ /** @@ -307,7 +306,7 @@ if ($action != 'export_csv') $accountingaccountstatic->fetch(null, $line->numero_compte, true); if (!empty($accountingaccountstatic->account_number)) { - $accounting_account = $accountingaccountstatic->getNomUrl(0, 1); + $accounting_account = $accountingaccountstatic->getNomUrl(0, 1, 0, '', 0, -1, 0, 'accountcard'); } else { $accounting_account = length_accountg($line->numero_compte); } @@ -322,10 +321,19 @@ if ($action != 'export_csv') $root_account_description = $tmparrayforrootaccount['label']; $root_account_number = $tmparrayforrootaccount['account_number']; + //var_dump($tmparrayforrootaccount); + //var_dump($accounting_account); + //var_dump($accountingaccountstatic); if (empty($accountingaccountstatic->label) && $accountingaccountstatic->id > 0) { $link = '' . img_edit() . ''; - } elseif (empty($tmparrayforrootaccount['label'])) { + } elseif ($accounting_account == 'NotDefined') { $link = '' . img_edit_add() . ''; + } 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 = '' . img_edit_add() . ''; } if (!empty($show_subgroup)) @@ -363,8 +371,22 @@ if ($action != 'export_csv') print ''; print ''.$accounting_account.''; if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) print ''.price($opening_balance).''; - print ''.price($line->debit).''; - print ''.price($line->credit).''; + + $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 ''.price($line->debit).''; + // Credit + print ''.price($line->credit).''; + if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) { print ''.price(price2num($opening_balance + $line->debit - $line->credit, 'MT')).''; } else { diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index 21077dececd..e5a061d34bd 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -63,9 +63,11 @@ $accountingjournal->fetch(null, $journal_code); $journal_label = $accountingjournal->label; $subledger_account = GETPOST('subledger_account', 'alphanohtml'); -if ($subledger_account == - 1) { +if ($subledger_account == -1) { $subledger_account = null; } +$subledger_label = GETPOST('subledger_label', 'alphanohtml'); + $label_operation = GETPOST('label_operation', 'alphanohtml'); $debit = price2num(GETPOST('debit', 'alpha')); $credit = price2num(GETPOST('credit', 'alpha')); @@ -108,6 +110,7 @@ if ($action == "confirm_update") { } else { $object->numero_compte = $accountingaccount_number; $object->subledger_account = $subledger_account; + $object->subledger_label = $subledger_label; $object->label_compte = $accountingaccount_label; $object->label_operation = $label_operation; $object->debit = $debit; @@ -160,6 +163,7 @@ if ($action == "confirm_update") { $object->numero_compte = $accountingaccount_number; $object->subledger_account = $subledger_account; + $object->subledger_label = $subledger_label; $object->label_compte = $accountingaccount_label; $object->label_operation = $label_operation; $object->debit = $debit; @@ -578,7 +582,7 @@ if ($action == 'create') print '
'; - $result = $object->fetchAllPerMvt($piece_num, $mode); + $result = $object->fetchAllPerMvt($piece_num, $mode); // This load $object->linesmvt if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } else { @@ -630,9 +634,10 @@ if ($action == 'create') 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); } else { - print 'subledger_account).'">'; + print 'subledger_account).'" placeholder="'.dol_escape_htmltag($langs->trans("SubledgerAccount")).'">'; } - // TODO Add also the label + // Add also input for subledger label + print '
subledger_label).'" placeholder="'.dol_escape_htmltag($langs->trans("SubledgerAccountLabel")).'">'; print ''; print 'label_operation).'">'; print 'debit)).'">'; @@ -644,20 +649,24 @@ if ($action == 'create') } else { $accountingaccount->fetch(null, $line->numero_compte, true); print ''.$accountingaccount->getNomUrl(0, 1, 1, '', 0).''; - print ''.length_accounta($line->subledger_account).''; + print ''.length_accounta($line->subledger_account); + if ($line->subledger_label) { + print ' - '.$line->subledger_label.''; + } + print ''; print ''.$line->label_operation.''; print ''.price($line->debit).''; print ''.price($line->credit).''; print ''; - print 'id.'&piece_num='.$line->piece_num.'&mode='.$mode.'">'; + print 'id.'&piece_num='.urlencode($line->piece_num).'&mode='.urlencode($mode).'&token='.urlencode(newToken()).'">'; print img_edit('', 0, 'class="marginrightonly"'); print '  '; $actiontodelete = 'delete'; if ($mode == '_tmp' || $action != 'delmouv') $actiontodelete = 'confirm_delete'; - print ''; + print ''; print img_delete(); print ''; @@ -688,9 +697,9 @@ if ($action == 'create') if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) { print $formaccounting->select_auxaccount('', 'subledger_account', 1); } else { - print ''; + print ''; } - // TODO Add also the label + print '
'; print ''; print ''; print ''; diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 92e407732e0..065c0b06d08 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -87,7 +87,7 @@ $search_debit = GETPOST('search_debit', 'alpha'); $search_credit = GETPOST('search_credit', 'alpha'); $search_ledger_code = GETPOST('search_ledger_code', 'array'); $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 $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 ''; print ''; - print '
'.$langs->trans("NotReconciled").''; + print '
'.$langs->trans("NotReconciled").''; print ''; } diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index 21b8c51380d..9e62f9e0b79 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -74,7 +74,7 @@ $search_ledger_code = GETPOST('search_ledger_code', 'array'); $search_debit = GETPOST('search_debit', 'alpha'); $search_credit = GETPOST('search_credit', '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")) { $action = 'delbookkeepingyear'; @@ -516,7 +516,7 @@ if (!empty($arrayfields['t.lettering_code']['checked'])) { print ''; print ''; - print '
'.$langs->trans("NotReconciled").''; + print '
'.$langs->trans("NotReconciled").''; print ''; } // Date export diff --git a/htdocs/accountancy/bookkeeping/listbysubaccount.php b/htdocs/accountancy/bookkeeping/listbysubaccount.php index b7ef25fd821..01b1a0a1335 100644 --- a/htdocs/accountancy/bookkeeping/listbysubaccount.php +++ b/htdocs/accountancy/bookkeeping/listbysubaccount.php @@ -74,7 +74,7 @@ $search_ledger_code = GETPOST('search_ledger_code', 'array'); $search_debit = GETPOST('search_debit', 'alpha'); $search_credit = GETPOST('search_credit', '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")) { $action = 'delbookkeepingyear'; @@ -544,7 +544,7 @@ if (!empty($arrayfields['t.credit']['checked'])) { if (!empty($arrayfields['t.lettering_code']['checked'])) { print ''; print ''; - print '
'.$langs->trans("NotReconciled").''; + print '
'.$langs->trans("NotReconciled").''; print ''; } // Date export diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index b936f99925a..382b7ee6f62 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -57,8 +57,8 @@ class AccountancyExport public static $EXPORT_TYPE_OPENCONCERTO = 100; public static $EXPORT_TYPE_LDCOMPTA = 110; public static $EXPORT_TYPE_LDCOMPTA10 = 120; - public static $EXPORT_TYPE_GESTINUMV3 = 130; - public static $EXPORT_TYPE_GESTINUMV5 = 135; + public static $EXPORT_TYPE_GESTIMUMV3 = 130; + public static $EXPORT_TYPE_GESTIMUMV5 = 135; public static $EXPORT_TYPE_FEC = 1000; public static $EXPORT_TYPE_FEC2 = 1010; @@ -119,8 +119,8 @@ class AccountancyExport self::$EXPORT_TYPE_CHARLEMAGNE => $langs->trans('Modelcsv_charlemagne'), self::$EXPORT_TYPE_LDCOMPTA => $langs->trans('Modelcsv_LDCompta'), self::$EXPORT_TYPE_LDCOMPTA10 => $langs->trans('Modelcsv_LDCompta10'), - self::$EXPORT_TYPE_GESTINUMV3 => $langs->trans('Modelcsv_Gestinum_v3'), - self::$EXPORT_TYPE_GESTINUMV5 => $langs->trans('Modelcsv_Gestinum_v5'), + self::$EXPORT_TYPE_GESTIMUMV3 => $langs->trans('Modelcsv_Gestinum_v3'), + self::$EXPORT_TYPE_GESTIMUMV5 => $langs->trans('Modelcsv_Gestinum_v5'), self::$EXPORT_TYPE_FEC => $langs->trans('Modelcsv_FEC'), self::$EXPORT_TYPE_FEC2 => $langs->trans('Modelcsv_FEC2'), ); @@ -154,8 +154,8 @@ class AccountancyExport self::$EXPORT_TYPE_CHARLEMAGNE => 'charlemagne', self::$EXPORT_TYPE_LDCOMPTA => 'ldcompta', self::$EXPORT_TYPE_LDCOMPTA10 => 'ldcompta10', - self::$EXPORT_TYPE_GESTINUMV3 => 'gestinumv3', - self::$EXPORT_TYPE_GESTINUMV5 => 'gestinumv5', + self::$EXPORT_TYPE_GESTIMUMV3 => 'gestimumv3', + self::$EXPORT_TYPE_GESTIMUMV5 => 'gestimumv5', self::$EXPORT_TYPE_FEC => 'fec', self::$EXPORT_TYPE_FEC2 => 'fec2', ); @@ -227,11 +227,13 @@ class AccountancyExport self::$EXPORT_TYPE_LDCOMPTA10 => array( 'label' => $langs->trans('Modelcsv_LDCompta10'), ), - self::$EXPORT_TYPE_GESTINUMV3 => array( + self::$EXPORT_TYPE_GESTIMUMV3 => array( 'label' => $langs->trans('Modelcsv_Gestinumv3'), + 'ACCOUNTING_EXPORT_FORMAT' => 'txt', ), - self::$EXPORT_TYPE_GESTINUMV5 => array( + self::$EXPORT_TYPE_GESTIMUMV5 => array( 'label' => $langs->trans('Modelcsv_Gestinumv5'), + 'ACCOUNTING_EXPORT_FORMAT' => 'txt', ), self::$EXPORT_TYPE_FEC => array( 'label' => $langs->trans('Modelcsv_FEC'), @@ -320,10 +322,10 @@ class AccountancyExport case self::$EXPORT_TYPE_LDCOMPTA10 : $this->exportLDCompta10($TData); break; - case self::$EXPORT_TYPE_GESTINUMV3 : + case self::$EXPORT_TYPE_GESTIMUMV3 : $this->exportGestimumV3($TData); break; - case self::$EXPORT_TYPE_GESTINUMV5 : + case self::$EXPORT_TYPE_GESTIMUMV5 : $this->exportGestimumV5($TData); break; case self::$EXPORT_TYPE_FEC : @@ -1638,81 +1640,85 @@ class AccountancyExport $invoices_infos = array(); $supplier_invoices_infos = array(); foreach ($objectLines as $line) { - $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; + if ($line->debit == 0 && $line->credit == 0) { + unset($array[$line]); } 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 = ','; foreach ($objectLines as $line) { - $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; + if ($line->debit == 0 && $line->credit == 0) { + unset($array[$line]); } 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; } } diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 8a3e6ebceb4..c8a12cef083 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -370,7 +370,7 @@ class BookKeeping extends CommonObject $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 .= ", '".$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->debit; $sql .= ", ".$this->credit; @@ -1914,25 +1914,24 @@ class BookKeeping extends CommonObject /** * 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 - * @return string Root account + * @return array Array with root account information (max 2 upper level) */ public function getRootAccount($account = null) { global $conf; $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 .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version"; $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 root ON parent.account_parent = root.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 AND root.active = 1"; $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').")"; 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); } - 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 { $this->error = "Error ".$this->db->lasterror(); dol_syslog(__METHOD__." ".$this->error, LOG_ERR); diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index af636c5609d..a5c603c2504 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -37,7 +37,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; // 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') @@ -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("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("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("VATRate", $_SERVER["PHP_SELF"], "fd.tva_tx", "", $param, '', $sortfield, $sortorder, 'right '); print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder); diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 2975c7de3c0..defe8bfd3b9 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -38,7 +38,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; // 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'); $massaction = GETPOST('massaction', 'alpha'); diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index c47255647cb..71839ecf08a 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -150,7 +150,7 @@ $userstatic = new User($db); $bankaccountstatic = new Account($db); $chargestatic = new ChargeSociales($db); $paymentdonstatic = new PaymentDonation($db); -$paymentvatstatic = new TVA($db); +$paymentvatstatic = new Tva($db); $paymentsalstatic = new PaymentSalary($db); $paymentexpensereportstatic = new PaymentExpenseReport($db); $paymentvariousstatic = new PaymentVarious($db); diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index 4bb163b6653..70d6d89216f 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -38,7 +38,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; // 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') @@ -334,16 +334,16 @@ if ($result) { print ''; 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("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("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("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("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("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); $checkpicto = $form->showCheckAddButtons(); print_liste_field_titre($checkpicto, '', '', '', '', '', '', '', 'center '); diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index 2f9141eb322..37f596c05c1 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -39,7 +39,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; // 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'); $massaction = GETPOST('massaction', 'alpha'); diff --git a/htdocs/adherents/admin/adherent.php b/htdocs/adherents/admin/adherent.php index 8acf1f1b191..fef3bd53177 100644 --- a/htdocs/adherents/admin/adherent.php +++ b/htdocs/adherents/admin/adherent.php @@ -136,7 +136,7 @@ if ($action == 'update' || $action == 'add') { $constnote = GETPOST('constnote'); $res = dolibarr_set_const($db, $constname, $constvalue, $choices[$consttype], 0, $constnote, $conf->entity); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); diff --git a/htdocs/adherents/admin/adherent_emails.php b/htdocs/adherents/admin/adherent_emails.php index 4374d281895..21ce5037ef5 100644 --- a/htdocs/adherents/admin/adherent_emails.php +++ b/htdocs/adherents/admin/adherent_emails.php @@ -92,7 +92,7 @@ if ($action == 'update' || $action == 'add') { $res = dolibarr_set_const($db, $constname, $constvalue, $typetouse, 0, $constnote, $conf->entity); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); diff --git a/htdocs/adherents/admin/website.php b/htdocs/adherents/admin/website.php index d0cdb098bae..e3acf3c4d99 100644 --- a/htdocs/adherents/admin/website.php +++ b/htdocs/adherents/admin/website.php @@ -63,7 +63,7 @@ if ($action == 'update') { $res = dolibarr_set_const($db, "MEMBER_NEWFORM_FORCETYPE", $forcetype, 'chaine', 0, '', $conf->entity); } - if (!$res > 0) $error++; + if (!($res > 0)) $error++; if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); diff --git a/htdocs/admin/agenda.php b/htdocs/admin/agenda.php index b1cc1d7619b..efdd6213dd5 100644 --- a/htdocs/admin/agenda.php +++ b/htdocs/admin/agenda.php @@ -97,7 +97,7 @@ if ($action == "save" && empty($cancel)) 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); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; } } diff --git a/htdocs/admin/agenda_extsites.php b/htdocs/admin/agenda_extsites.php index 7fbd139072d..f99c530c7e2 100644 --- a/htdocs/admin/agenda_extsites.php +++ b/htdocs/admin/agenda_extsites.php @@ -82,15 +82,15 @@ if ($actionsave) //print '-name='.$name.'-color='.$color; $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); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; $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); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; $res = dolibarr_set_const($db, 'AGENDA_EXT_ENABLED'.$i, $enabled, 'chaine', 0, '', $conf->entity); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; $i++; } @@ -98,7 +98,7 @@ if ($actionsave) if (!$error) { $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; $MAXAGENDA = empty($conf->global->AGENDA_EXT_NB) ? 5 : $conf->global->AGENDA_EXT_NB; } diff --git a/htdocs/admin/agenda_other.php b/htdocs/admin/agenda_other.php index c1f77f4995e..a072869be8c 100644 --- a/htdocs/admin/agenda_other.php +++ b/htdocs/admin/agenda_other.php @@ -51,6 +51,7 @@ $type = 'action'; include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; +$reg = array(); if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) { $code = $reg[1]; diff --git a/htdocs/admin/bank.php b/htdocs/admin/bank.php index d21ffdb1630..4cd7bff4ed8 100644 --- a/htdocs/admin/bank.php +++ b/htdocs/admin/bank.php @@ -112,7 +112,7 @@ if ($actionsave) if ($color == '-1') $color = ''; $res = dolibarr_set_const($db, 'BANK_COLORIZE_MOVEMENT_COLOR'.$i, $color, 'chaine', 0, '', $conf->entity); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; $i++; } diff --git a/htdocs/admin/bom.php b/htdocs/admin/bom.php index 34c3af89c53..36b5ab91f67 100644 --- a/htdocs/admin/bom.php +++ b/htdocs/admin/bom.php @@ -52,7 +52,7 @@ if ($action == 'updateMask') if ($maskconstbom) $res = dolibarr_set_const($db, $maskconstbom, $maskbom, 'chaine', 0, '', $conf->entity); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; if (!$error) { @@ -141,7 +141,7 @@ elseif ($action == 'setdoc') $draft = GETPOST("BOM_DRAFT_WATERMARK"); $res = dolibarr_set_const($db, "BOM_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; if (!$error) { @@ -155,7 +155,7 @@ elseif ($action == 'setdoc') $res = dolibarr_set_const($db, "BOM_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; if (!$error) { diff --git a/htdocs/admin/chequereceipts.php b/htdocs/admin/chequereceipts.php index 8c2acb5dc8b..f00e6454761 100644 --- a/htdocs/admin/chequereceipts.php +++ b/htdocs/admin/chequereceipts.php @@ -55,7 +55,7 @@ if ($action == 'updateMask') $maskchequereceipts = GETPOST('maskchequereceipts', 'alpha'); if ($maskconstchequereceipts) $res = dolibarr_set_const($db, $maskconstchequereceipts, $maskchequereceipts, 'chaine', 0, '', $conf->entity); - if (!$res > 0) $error++; + if (!($res > 0)) $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); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; if (!$error) { diff --git a/htdocs/admin/commande.php b/htdocs/admin/commande.php index cde0253f99a..5e5655f918f 100644 --- a/htdocs/admin/commande.php +++ b/htdocs/admin/commande.php @@ -61,7 +61,7 @@ if ($action == 'updateMask') if ($maskconstorder) $res = dolibarr_set_const($db, $maskconstorder, $maskorder, 'chaine', 0, '', $conf->entity); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; if (!$error) { @@ -146,7 +146,7 @@ elseif ($action == 'setdoc') { $draft = GETPOST("COMMANDE_DRAFT_WATERMARK"); $res = dolibarr_set_const($db, "COMMANDE_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; if (!$error) { @@ -160,7 +160,7 @@ elseif ($action == 'setdoc') { $res = dolibarr_set_const($db, "ORDER_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; if (!$error) { @@ -172,7 +172,7 @@ elseif ($action == 'setdoc') { // Activate Set Shippable Icon In List $setshippableiconinlist = GETPOST('value', 'int'); $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) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } 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_CHQ_NUMBER", $chq, 'chaine', 0, '', $conf->entity); - if (!$res > 0) $error++; + if (!($res > 0)) $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); - if (!$res > 0) $error++; + if (!($res > 0)) $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); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; if (!$error) { diff --git a/htdocs/admin/contract.php b/htdocs/admin/contract.php index b5e4c0ddf45..05330e92b89 100644 --- a/htdocs/admin/contract.php +++ b/htdocs/admin/contract.php @@ -57,7 +57,7 @@ if ($action == 'updateMask') $maskvalue = GETPOST('maskcontract', 'alpha'); if ($maskconst) $res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; if (!$error) { diff --git a/htdocs/admin/delivery.php b/htdocs/admin/delivery.php index b1606268205..9b9060aa054 100644 --- a/htdocs/admin/delivery.php +++ b/htdocs/admin/delivery.php @@ -58,7 +58,7 @@ if ($action == 'updateMask') $maskdelivery = GETPOST('maskdelivery', 'alpha'); if ($maskconstdelivery) $res = dolibarr_set_const($db, $maskconstdelivery, $maskdelivery, 'chaine', 0, '', $conf->entity); - if (!$res > 0) $error++; + if (!($res > 0)) $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 $res = dolibarr_set_const($db, "DELIVERY_FREE_TEXT", $free, 'chaine', 0, '', $conf->entity); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; if (!$error) { diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index daf15552300..80398531515 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -236,7 +236,7 @@ $tabsqlsort[3] = "country ASC, code ASC"; $tabsqlsort[4] = "code ASC"; $tabsqlsort[5] = "label 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[9] = "label 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 == 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 == 7) $sql .= natural_search("a.code", $search_code); elseif ($search_code != '' && $id != 9) $sql .= natural_search("code", $search_code); if ($sortfield) @@ -1107,7 +1108,6 @@ if ($id) // Form to add a new line if ($tabname[$id]) { - $alabelisused = 0; $withentity = null; $fieldlist = explode(',', $tabfield[$id]); @@ -1214,7 +1214,6 @@ if ($id) else $tdsoffields .= $valuetoshow; $tdsoffields .= ''; } - if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') $alabelisused = 1; } if ($id == 4) $tdsoffields .= ''; diff --git a/htdocs/admin/expensereport.php b/htdocs/admin/expensereport.php index 61688e18515..ad04e09ffd1 100644 --- a/htdocs/admin/expensereport.php +++ b/htdocs/admin/expensereport.php @@ -61,7 +61,7 @@ if ($action == 'updateMask') { $res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity); } - if (!$res > 0) { + if (!($res > 0)) { $error++; } diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php index 00dcb7c3180..c5b8262c4be 100644 --- a/htdocs/admin/facture.php +++ b/htdocs/admin/facture.php @@ -66,7 +66,7 @@ if ($action == 'updateMask') 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 (!$res > 0) $error++; + if (!($res > 0)) $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_CHQ_NUMBER", $chq, 'chaine', 0, '', $conf->entity); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; if (!$error) { @@ -170,7 +170,7 @@ elseif ($action == 'setdoc') $res = dolibarr_set_const($db, "FACTURE_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; if (!$error) { @@ -184,7 +184,7 @@ elseif ($action == 'setdoc') $res = dolibarr_set_const($db, "INVOICE_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; if (!$error) { @@ -198,7 +198,7 @@ elseif ($action == 'setdoc') $res = dolibarr_set_const($db, "FAC_FORCE_DATE_VALIDATION", $forcedate, 'chaine', 0, '', $conf->entity); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; if (!$error) { @@ -217,7 +217,7 @@ elseif ($action == 'setdoc') foreach ($invoicetypemodels as $type => $value) { $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) diff --git a/htdocs/admin/fichinter.php b/htdocs/admin/fichinter.php index e3178d946a0..afe6bc2239c 100644 --- a/htdocs/admin/fichinter.php +++ b/htdocs/admin/fichinter.php @@ -58,7 +58,7 @@ if ($action == 'updateMask') $maskvalue = GETPOST('maskvalue', 'alpha'); if ($maskconst) $res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; if (!$error) { @@ -147,7 +147,7 @@ elseif ($action == 'setdoc') $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); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; if (!$error) { @@ -160,7 +160,7 @@ elseif ($action == 'setdoc') $draft = GETPOST('FICHINTER_DRAFT_WATERMARK', 'alpha'); $res = dolibarr_set_const($db, "FICHINTER_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; if (!$error) { @@ -173,7 +173,7 @@ elseif ($action == 'setdoc') $val = GETPOST('FICHINTER_PRINT_PRODUCTS', 'alpha'); $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) { @@ -185,7 +185,7 @@ elseif ($action == 'setdoc') $val = GETPOST('FICHINTER_USE_SERVICE_DURATION', 'alpha'); $res = dolibarr_set_const($db, "FICHINTER_USE_SERVICE_DURATION", ($val == 'on' ? 1 : 0), 'bool', 0, '', $conf->entity); - if (!$res > 0) { + if (!($res > 0)) { $error++; } @@ -198,7 +198,7 @@ elseif ($action == 'setdoc') $val = GETPOST('FICHINTER_WITHOUT_DURATION', 'alpha'); $res = dolibarr_set_const($db, "FICHINTER_WITHOUT_DURATION", ($val == 'on' ? 1 : 0), 'bool', 0, '', $conf->entity); - if (!$res > 0) { + if (!($res > 0)) { $error++; } @@ -211,7 +211,7 @@ elseif ($action == 'setdoc') $val = GETPOST('FICHINTER_DATE_WITHOUT_HOUR', 'alpha'); $res = dolibarr_set_const($db, "FICHINTER_DATE_WITHOUT_HOUR", ($val == 'on' ? 1 : 0), 'bool', 0, '', $conf->entity); - if (!$res > 0) { + if (!($res > 0)) { $error++; } diff --git a/htdocs/admin/holiday.php b/htdocs/admin/holiday.php index eca8319d661..d8de2dd847d 100644 --- a/htdocs/admin/holiday.php +++ b/htdocs/admin/holiday.php @@ -59,7 +59,7 @@ if ($action == 'updateMask') $maskvalue = GETPOST('maskholiday', 'alpha'); if ($maskconst) $res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; if (!$error) { diff --git a/htdocs/admin/mailing.php b/htdocs/admin/mailing.php index 32aa7accfcf..4ea5db1cecd 100644 --- a/htdocs/admin/mailing.php +++ b/htdocs/admin/mailing.php @@ -36,6 +36,7 @@ $action = GETPOST('action', 'aZ09'); $form = new Form($db); + /* * Actions */ @@ -52,21 +53,20 @@ if ($action == 'setvalue') $contactbulkdefault = GETPOST('MAILING_CONTACT_DEFAULT_BULK_STATUS', 'int'); $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); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; $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); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; // Create temporary encryption key if nedded $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(); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { @@ -77,7 +77,7 @@ if ($action == 'setvalue') if ($action == 'setonsearchandlistgooncustomerorsuppliercard') { $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); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); diff --git a/htdocs/admin/mailman.php b/htdocs/admin/mailman.php index 8070beab59b..3c9c634a8cd 100644 --- a/htdocs/admin/mailman.php +++ b/htdocs/admin/mailman.php @@ -59,7 +59,7 @@ if ($action == 'update' || $action == 'add') $constnote = $_POST["constnote"][$key]; $res = dolibarr_set_const($db, $constname, $constvalue, $type[$consttype], 0, $constnote, $conf->entity); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; } if (!$error) diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index 5e32a637c8f..b0b18de20dc 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -532,6 +532,7 @@ if ($action == 'edit') print ''.$langs->trans("EMailsDesc")."
\n"; print "
\n"; + print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table print ''; print ''; @@ -552,10 +553,12 @@ if ($action == 'edit') } print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'; + print '
'; if (empty($conf->global->MAIN_DISABLE_ALL_MAILS)) { print '
'; + print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table print ''; print ''; @@ -663,6 +666,7 @@ if ($action == 'edit') } print '
'.$langs->trans("MAIN_MAIL_SENDMODE").'
'; + print '
'; if ($conf->global->MAIN_MAIL_SENDMODE == 'mail' && empty($conf->global->MAIN_HIDE_WARNING_TO_ENCOURAGE_SMTP_SETUP)) { print info_admin($langs->trans("WarningPHPMail").'
'.$langs->trans("WarningPHPMailA").'
'.$langs->trans("WarningPHPMailB").'
'.$langs->trans("WarningPHPMailC").'

'.$langs->trans("WarningPHPMailD"), 0, 0, 'warning'); @@ -670,13 +674,15 @@ if ($action == 'edit') print '
'; + print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table print ''; print ''; // From print ''; print ''; // Default from type @@ -746,6 +752,7 @@ if ($action == 'edit') print ''; print '
'.$langs->trans("OtherOptions").'
'.$langs->trans("MAIN_MAIL_EMAIL_FROM", ini_get('sendmail_from') ?ini_get('sendmail_from') : $langs->transnoentities("Undefined")).''.$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 '
'.$langs->trans("MAIN_MAIL_ENABLED_USER_DEST_SELECT").''.yn($conf->global->MAIN_MAIL_ENABLED_USER_DEST_SELECT).'
'; + print '
'; } print dol_get_fiche_end(); @@ -761,7 +768,7 @@ if ($action == 'edit') { if (function_exists('fsockopen') && $port && $server) { - print ''.$langs->trans("DoTestServerAvailability").''; + print ''.$langs->trans("DoTestServerAvailability").''; } } else { print ''.$langs->trans("DoTestServerAvailability").''; @@ -837,6 +844,7 @@ if ($action == 'edit') // Run the test to connect if ($action == 'testconnect') { + print '
'; print load_fiche_titre($langs->trans("DoTestServerAvailability")); include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; @@ -851,6 +859,7 @@ if ($action == 'edit') } setEventMessages($errormsg, null, 'errors'); + print $errormsg; } print '
'; } diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 1cf784de3c5..78f06b0ee2e 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -523,10 +523,10 @@ if ($mode == 'common' || $mode == 'commonkanban') { $moreforfilter .= '
'; $moreforfilter .= '
'; - $moreforfilter .= $langs->trans('Keyword').': '; + $moreforfilter .= img_picto($langs->trans("Filter"), 'filter', 'class="paddingright opacitymedium"').''; $moreforfilter .= '
'; $moreforfilter .= '
'; - $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 .= '
'; if (!empty($conf->global->MAIN_FEATURES_LEVEL)) { $array_version = array('stable'=>$langs->transnoentitiesnoconv("Stable")); @@ -540,11 +540,11 @@ if ($mode == 'common' || $mode == 'commonkanban') { $array_version['development'] = $langs->trans("Development"); } $moreforfilter .= '
'; - $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 .= '
'; } $moreforfilter .= '
'; - $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 .= '
'; $moreforfilter .= ' '; $moreforfilter .= '
'; @@ -937,6 +937,8 @@ if ($mode == 'common' || $mode == 'commonkanban') { if ($mode == 'marketplace') { print dol_get_fiche_head($head, $mode, '', -1); + print '
'; + // Marketplace print '
'; print ''."\n"; @@ -977,8 +979,8 @@ if ($mode == 'marketplace') { ?> -
trans('Keyword') ?>: -
+
+
@@ -1190,6 +1192,8 @@ if ($mode == 'deploy') { if ($mode == 'develop') { print dol_get_fiche_head($head, $mode, '', -1); + print '
'; + // Marketplace print "
\n"; print "\n"; diff --git a/htdocs/admin/mrp.php b/htdocs/admin/mrp.php index af6210eee1f..a5ae9d15e63 100644 --- a/htdocs/admin/mrp.php +++ b/htdocs/admin/mrp.php @@ -53,7 +53,7 @@ if ($action == 'updateMask') if ($maskconstmrp) $res = dolibarr_set_const($db, $maskconstmrp, $maskmrp, 'chaine', 0, '', $conf->entity); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; if (!$error) { @@ -142,7 +142,7 @@ elseif ($action == 'setdoc') $draft = GETPOST("MRP_MO_DRAFT_WATERMARK"); $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) { @@ -156,7 +156,7 @@ elseif ($action == 'setdoc') $res = dolibarr_set_const($db, "MRP_MO_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; if (!$error) { diff --git a/htdocs/admin/payment.php b/htdocs/admin/payment.php index 378e1b4fe68..925c8fd6ff4 100644 --- a/htdocs/admin/payment.php +++ b/htdocs/admin/payment.php @@ -51,7 +51,7 @@ if ($action == 'updateMask') $maskpayment = GETPOST('maskpayment', 'alpha'); if ($maskconstpayment) $res = dolibarr_set_const($db, $maskconstpayment, $maskpayment, 'chaine', 0, '', $conf->entity); - if (!$res > 0) $error++; + if (!($res > 0)) $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 $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); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; if ($error) { diff --git a/htdocs/admin/paymentbybanktransfer.php b/htdocs/admin/paymentbybanktransfer.php index a21b2aa6e1d..113c4e18510 100644 --- a/htdocs/admin/paymentbybanktransfer.php +++ b/htdocs/admin/paymentbybanktransfer.php @@ -50,10 +50,9 @@ if ($action == "set") $id = GETPOST('PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT', 'int'); $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); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; /* $res = dolibarr_set_const($db, "PRELEVEMENT_CODE_BANQUE", $account->code_banque,'chaine',0,'',$conf->entity); 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); if (! $res > 0) $error++; */ - } else $error++; + } else { + $error++; + } /* Moved to account $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) { $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") == "") { $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") == "") { $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") == "") { $res = dolibarr_set_const($db, "PAYMENTBYBANKTRANSFER_ADDDAYS", GETPOST("PAYMENTBYBANKTRANSFER_ADDDAYS"), 'chaine', 0, '', $conf->entity); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; } elseif (!$error) { $db->commit(); diff --git a/htdocs/admin/prelevement.php b/htdocs/admin/prelevement.php index 1d6d35c8719..a51fc8b39f4 100644 --- a/htdocs/admin/prelevement.php +++ b/htdocs/admin/prelevement.php @@ -55,7 +55,7 @@ if ($action == "set") if ($account->fetch($id) > 0) { $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); if (! $res > 0) $error++; @@ -75,21 +75,20 @@ if ($action == "set") } else $error++; /* Moved to account - $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) { $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") == "") { $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") == "") { $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); diff --git a/htdocs/admin/propal.php b/htdocs/admin/propal.php index 78c22e7b397..6d80aa78211 100644 --- a/htdocs/admin/propal.php +++ b/htdocs/admin/propal.php @@ -57,7 +57,7 @@ if ($action == 'updateMask') { $maskpropal = GETPOST('maskpropal', 'alpha'); if ($maskconstpropal) $res = dolibarr_set_const($db, $maskconstpropal, $maskpropal, 'chaine', 0, '', $conf->entity); - if (!$res > 0) $error++; + if (!($res > 0)) $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_CHQ_NUMBER", $chq, 'chaine', 0, '', $conf->entity); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; if (!$error) { @@ -121,7 +121,7 @@ if ($action == 'updateMask') { $draft = GETPOST('PROPALE_DRAFT_WATERMARK', 'alpha'); $res = dolibarr_set_const($db, "PROPALE_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; if (!$error) { @@ -134,7 +134,7 @@ if ($action == 'updateMask') { $res = dolibarr_set_const($db, "PROPOSAL_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; if (!$error) { @@ -145,7 +145,7 @@ if ($action == 'updateMask') { } elseif ($action == 'setdefaultduration') { $res = dolibarr_set_const($db, "PROPALE_VALIDITY_DURATION", $value, 'chaine', 0, '', $conf->entity); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; if (!$error) { @@ -156,7 +156,7 @@ if ($action == 'updateMask') { } 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); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); diff --git a/htdocs/admin/receiptprinter.php b/htdocs/admin/receiptprinter.php index 3c878c5c664..31f2228d401 100644 --- a/htdocs/admin/receiptprinter.php +++ b/htdocs/admin/receiptprinter.php @@ -443,7 +443,6 @@ if ($mode == 'template' && $user->admin) { print ''; print ''; print ''; diff --git a/htdocs/admin/spip.php b/htdocs/admin/spip.php index 2fa111578a9..018fb70a80d 100644 --- a/htdocs/admin/spip.php +++ b/htdocs/admin/spip.php @@ -67,7 +67,7 @@ if ($action == 'update' || $action == 'add') $res = dolibarr_set_const($db, $constname, $constvalue, $type[$consttype], 0, $constnote, $conf->entity); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; } if (!$error) diff --git a/htdocs/admin/stock.php b/htdocs/admin/stock.php index db7f005284f..fa4676bc6ce 100644 --- a/htdocs/admin/stock.php +++ b/htdocs/admin/stock.php @@ -96,7 +96,7 @@ if ($action == 'warehouse') if ($value == -1 || empty($value) && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE)) { $res = dolibarr_del_const($db, "MAIN_DEFAULT_WAREHOUSE", $conf->entity); } - if (!$res > 0) $error++; + if (!($res > 0)) $error++; } if ($action == 'specimen') diff --git a/htdocs/admin/supplier_invoice.php b/htdocs/admin/supplier_invoice.php index 86faa655687..b7a14a53541 100644 --- a/htdocs/admin/supplier_invoice.php +++ b/htdocs/admin/supplier_invoice.php @@ -65,7 +65,7 @@ if ($action == 'updateMask') 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 (!$res > 0) $error++; + if (!($res > 0)) $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); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; if (!$error) { diff --git a/htdocs/admin/supplier_order.php b/htdocs/admin/supplier_order.php index e2433c5348b..f255a77348a 100644 --- a/htdocs/admin/supplier_order.php +++ b/htdocs/admin/supplier_order.php @@ -63,7 +63,7 @@ if ($action == 'updateMask') if ($maskconstorder) $res = dolibarr_set_const($db, $maskconstorder, $maskvalue, 'chaine', 0, '', $conf->entity); - if (!$res > 0) $error++; + if (!($res > 0)) $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); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; if (!$error) { diff --git a/htdocs/admin/supplier_payment.php b/htdocs/admin/supplier_payment.php index 3408496de31..c0e0d650d90 100644 --- a/htdocs/admin/supplier_payment.php +++ b/htdocs/admin/supplier_payment.php @@ -52,7 +52,7 @@ if ($action == 'updateMask') $masksupplierpayment = GETPOST('masksupplierpayment', 'alpha'); if ($maskconstsupplierpayment) $res = dolibarr_set_const($db, $maskconstsupplierpayment, $masksupplierpayment, 'chaine', 0, '', $conf->entity); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; if (!$error) { @@ -136,7 +136,7 @@ elseif ($action == 'setdoc') } 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); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; if ($error) { diff --git a/htdocs/admin/supplier_proposal.php b/htdocs/admin/supplier_proposal.php index 0855a41cf8f..dac0a733782 100644 --- a/htdocs/admin/supplier_proposal.php +++ b/htdocs/admin/supplier_proposal.php @@ -55,7 +55,7 @@ if ($action == 'updateMask') $masksupplier_proposal = GETPOST('masksupplier_proposal', 'alpha'); 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) { @@ -111,7 +111,7 @@ if ($action == 'set_SUPPLIER_PROPOSAL_DRAFT_WATERMARK') $draft = GETPOST('SUPPLIER_PROPOSAL_DRAFT_WATERMARK', 'alpha'); $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) { @@ -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); - if (!$res > 0) $error++; + if (!($res > 0)) $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); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; if (!$error) { diff --git a/htdocs/admin/syslog.php b/htdocs/admin/syslog.php index 45500843aed..c884e30da75 100644 --- a/htdocs/admin/syslog.php +++ b/htdocs/admin/syslog.php @@ -138,7 +138,7 @@ if ($action == 'setlevel') $res = dolibarr_set_const($db, "SYSLOG_LEVEL", $level, 'chaine', 0, '', 0); dol_syslog("admin/syslog: level ".$level); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; if (!$error) { @@ -146,7 +146,7 @@ if ($action == 'setlevel') $res = dolibarr_set_const($db, "SYSLOG_FILE_SAVES", $file_saves, 'chaine', 0, '', 0); dol_syslog("admin/syslog: file saves ".$file_saves); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; } if (!$error) diff --git a/htdocs/admin/system/dolibarr.php b/htdocs/admin/system/dolibarr.php index 1100b86f412..5e89d8ae683 100644 --- a/htdocs/admin/system/dolibarr.php +++ b/htdocs/admin/system/dolibarr.php @@ -73,7 +73,7 @@ print load_fiche_titre($title, '', 'title_setup'); // Version print '
'; print '
'; print ''; print '
'; -print ''."\n"; +print ''."\n"; print '
'.$langs->trans("Version").''.$langs->trans("Value").'
'.$langs->trans("Version").''.$langs->trans("Value").'
'.$langs->trans("CurrentVersion").' ('.$langs->trans("Programs").')'.DOL_VERSION; // If current version differs from last upgrade if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE)) @@ -139,7 +139,7 @@ print '
'; // Session print '
'; print ''; -print ''."\n"; +print ''."\n"; print ''."\n"; print ''."\n"; print ''."\n"; @@ -180,7 +180,7 @@ if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_S print '
'; print '
'.$langs->trans("Session").''.$langs->trans("Value").'
'.$langs->trans("Session").''.$langs->trans("Value").'
'.$langs->trans("SessionSavePath").''.session_save_path().'
'.$langs->trans("SessionName").''.session_name().'
'.$langs->trans("SessionId").''.session_id().'
'; print ''; - print ''; + print ''; print ''; print ''; print ''."\n"; @@ -202,7 +202,7 @@ if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_S // Localisation print '
'; print '
'.$langs->trans("LanguageFilesCachedIntoShmopSharedMemory").''.$langs->trans("LanguageFilesCachedIntoShmopSharedMemory").''.$langs->trans("NbOfEntries").''.$langs->trans("Address").'
'; -print ''."\n"; +print ''."\n"; print ''."\n"; print ''."\n"; // Thousands @@ -222,7 +222,22 @@ if (($thousand != ',' && $thousand != '.') || ($thousand != ' ')) print "\n"; } print ''."\n"; -// Timezone + +// Timezones + +// Database timezone +if ($conf->db->type == 'mysql' || $conf->db->type == 'mysqli') +{ + print ''."\n"; +} $txt = $langs->trans("OSTZ").' (variable system TZ): '.(!empty($_ENV["TZ"]) ? $_ENV["TZ"] : $langs->trans("NotDefined")).'
'."\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")))."
\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); @@ -238,23 +253,10 @@ $val .= '       '.getServerTimeZoneString(); $val .= '       '.$langs->trans("DaylingSavingTime").': '.($daylight === 'unknown' ? 'unknown' : ($a == $c ?yn($daylight) : yn(0).($daylight ? '     ('.$langs->trans('YesInSummer').')' : ''))); print $form->textwithtooltip($val, $txt, 2, 1, img_info('')); print ''."\n"; // value defined in http://fr3.php.net/manual/en/timezones.europe.php -print ''."\n"; +print ''."\n"; print ''; print ''; print ''; -// Database timezone -if ($conf->db->type == 'mysql' || $conf->db->type == 'mysqli') -{ - print ''."\n"; -} // Client $tz = (int) $_SESSION['dol_tz'] + (int) $_SESSION['dol_dst']; print ''."\n"; print ''."\n"; -print ''."\n"; +print ''."\n"; $filesystemencoding = ini_get("unicode.filesystem_encoding"); // Disponible avec PHP 6.0 print ''."\n"; @@ -340,7 +342,7 @@ $configfileparameters = array( print '
'; print '
'.$langs->trans("LocalisationDolibarrParameters").''.$langs->trans("Value").'
'.$langs->trans("LocalisationDolibarrParameters").''.$langs->trans("Value").'
'.$langs->trans("LanguageBrowserParameter", "HTTP_ACCEPT_LANGUAGE").''.$_SERVER["HTTP_ACCEPT_LANGUAGE"].'
'.$langs->trans("CurrentUserLanguage").''.$langs->getDefaultLang().'
  => price(1234.56)'.price(1234.56).'
'.$langs->trans("MySQLTimeZone").' (database)'; // 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 '
  => '.$langs->trans("CurrentHour").''.dol_print_date(dol_now(), 'dayhour', 'tzserver').'
  => '.$langs->trans("CurrentHour").''.dol_print_date(dol_now('gmt'), 'dayhour', 'tzserver').'
  => dol_print_date(0,"dayhourtext")'.dol_print_date(0, "dayhourtext").'
  => dol_get_first_day(1970,1,false)'.dol_get_first_day(1970, 1, false).'     (=> dol_print_date() or idate() of this value = '.dol_print_date(dol_get_first_day(1970, 1, false), 'dayhour').')
  => dol_get_first_day(1970,1,true)'.dol_get_first_day(1970, 1, true).'     (=> dol_print_date() or idate() of this value = '.dol_print_date(dol_get_first_day(1970, 1, true), 'dayhour').')
'.$langs->trans("MySQLTimeZone").' (database)'; // 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 '
'.$langs->trans("ClientTZ").''.($tz ? ($tz >= 0 ? '+' : '').$tz : '').' ('.($tz >= 0 ? '+' : '').($tz * 60 * 60).')'; @@ -265,7 +267,7 @@ else print yn(0); if (!empty($_SESSION['dol_dst_first'])) print '     ('.dol_print_date(dol_stringtotime($_SESSION['dol_dst_first']), 'dayhour', 'gmt').' - '.dol_print_date(dol_stringtotime($_SESSION['dol_dst_second']), 'dayhour', 'gmt').')'; print '
  => '.$langs->trans("ClientHour").''.dol_print_date(dol_now(), 'dayhour', 'tzuser').'
  => '.$langs->trans("ClientHour").''.dol_print_date(dol_now('gmt'), 'dayhour', 'tzuser').'
'.$langs->trans("File encoding").' (php.ini unicode.filesystem_encoding)'.$filesystemencoding.'
'; print ''; -print ''; print ''; diff --git a/htdocs/admin/system/phpinfo.php b/htdocs/admin/system/phpinfo.php index 388b61c75cf..ea628621bce 100644 --- a/htdocs/admin/system/phpinfo.php +++ b/htdocs/admin/system/phpinfo.php @@ -93,13 +93,13 @@ if ($maxphp > 0 && $maxphp2 > 0 && $maxphp > $maxphp2) print '
'.$langs->trans("Parameters").' '; +print ''.$langs->trans("Parameters").' '; print $langs->trans("ConfigurationFile").' ('.$conffiletoshowshort.')'; print ''.$langs->trans("Parameter").'
'; -print ''; +print ''; $ErrorPicturePath = "../../theme/eldy/img/error.png"; $WarningPicturePath = "../../theme/eldy/img/warning.png"; $OkayPicturePath = "../../theme/eldy/img/tick.png"; -print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("Version").''; +print '
'.$langs->trans("Version").''; $arrayphpminversionerror = array(5, 5, 0); $arrayphpminversionwarning = array(5, 6, 0); @@ -153,11 +153,8 @@ $loadedExtensions = array_map('strtolower', get_loaded_extensions(false)); print ''; print ''; -print ''; -//print ''; -print ''; -print ''; -print ''; +print ''; +print ''; print ''; $functions = ["mb_check_encoding"]; @@ -165,9 +162,6 @@ $name = "MBString"; print ""; print ""; -//print getTableColumn($name, $activatedExtensions); -print getTableColumn($name, $loadedExtensions); -print getTableColumnFunction($functions); print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions); print ""; @@ -176,9 +170,6 @@ $name = "JSON"; print ""; print ""; -//print getTableColumn($name, $activatedExtensions); -print getTableColumn($name, $loadedExtensions); -print getTableColumnFunction($functions); print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions); print ""; @@ -187,8 +178,6 @@ $name = "GD"; print ""; print ""; -print getTableColumn($name, $loadedExtensions); -print getTableColumnFunction($functions); print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions); print ""; @@ -197,8 +186,6 @@ $name = "Curl"; print ""; print ""; -print getTableColumn($name, $loadedExtensions); -print getTableColumnFunction($functions); print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions); print ""; @@ -209,8 +196,6 @@ if (empty($_SERVER["SERVER_ADMIN"]) || $_SERVER["SERVER_ADMIN"] != 'doliwamp@loc print ""; print ""; - print getTableColumn($name, $loadedExtensions); - print getTableColumnFunction($functions); print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions); print ""; } @@ -220,8 +205,6 @@ $name = "IMAP"; print ""; print ""; -print getTableColumn($name, $loadedExtensions); -print getTableColumnFunction($functions); print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions); print ""; @@ -230,8 +213,6 @@ $name = "xDebug"; print ""; print ""; -print getTableColumn($name, $loadedExtensions); -print getTableColumnFunction($functions); print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions); print ""; @@ -246,7 +227,7 @@ foreach ($phparray as $key => $value) print '
'; print '
'.$langs->trans("Extension").''.$langs->trans("EnabledInSetup").''.$langs->trans("Loaded").''.$langs->trans("FunctionTest").''.$langs->trans("Result").''.$langs->trans("Extension").''.$langs->trans("Test").'
".$name."
".$name."
".$name."
".$name."
".$name."
".$name."
".$name."
'; print ''; - print ''; + print ''; print ''; print "\n"; @@ -293,69 +274,6 @@ llxFooter(); $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 = ""; - - 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 ""; - } - - $result = true; - $html = ""; - - return $html; -} - /** * 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 $loaded A list with all loaded PHP extensions * @param array $functions A list with all PHP functions to check - * * @return string */ function getResultColumn($name, array $activated, array $loaded, array $functions) @@ -371,6 +288,7 @@ function getResultColumn($name, array $activated, array $loaded, array $function global $langs; $result = true; + //$result = $result && in_array(strtolower($name), $activated); $result = $result && in_array(strtolower($name), $loaded); @@ -380,7 +298,29 @@ function getResultColumn($name, array $activated, array $loaded, array $function } $html = ""; return $html; diff --git a/htdocs/admin/system/security.php b/htdocs/admin/system/security.php index f978c0dcd81..f0ada86a393 100644 --- a/htdocs/admin/system/security.php +++ b/htdocs/admin/system/security.php @@ -43,9 +43,6 @@ if (GETPOST('action', 'aZ09') == 'donothing') * View */ -$form = new Form($db); -$nowstring = dol_print_date(dol_now(), 'dayhourlog'); - llxHeader(); print load_fiche_titre($langs->trans("Security"), '', 'title_setup'); @@ -78,7 +75,7 @@ else { print '
'; print '
'; -print load_fiche_titre($langs->trans("ConfigFile"), '', 'folder'); +print load_fiche_titre($langs->trans("ConfigurationFile"), '', 'folder'); print ''.$langs->trans("dolibarr_main_prod").': '.$dolibarr_main_prod; if (empty($dolibarr_main_prod)) { @@ -90,7 +87,12 @@ print ''.$langs->trans("dolibarr_nocsrfcheck").': '.$dolibarr_n if (!empty($dolibarr_nocsrfcheck)) { print img_picto('', 'warning').'   '.$langs->trans("IfYouAreOnAProductionSetThis", 0); } +print '
'; +print ''.$langs->trans("dolibarr_main_restrict_ip").': '.$dolibarr_main_restrict_ip; +/*if (empty($dolibarr_main_restrict_ip)) { + print '   '.img_picto('', 'warning').' '.$langs->trans("IfYouAreOnAProductionSetThis", 1); +}*/ print '
'; print '
'; @@ -102,9 +104,17 @@ print ''.$langs->trans("PermissionsOnFilesInWebRoot").': '; print 'TODO'; print '
'; -print ''.$langs->trans("PermissionsOnFile", 'conf.php').': '; -// TODO Check permission on file conf.php (read only for the web user) -print 'TODO'; +print ''.$langs->trans("PermissionsOnFile", $conffile).': '; // $conffile is defined into filefunc.inc.php +$perms = fileperms($dolibarr_main_document_root.'/'.$conffile); +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 '
'; print '
'; @@ -137,14 +147,15 @@ print '
'; print load_fiche_titre($langs->trans("Menu").' '.$langs->trans("SecuritySetup"), '', 'folder'); //print ''.$langs->trans("PasswordEncryption").': '; -print 'MAIN_SECURITY_HASH_ALGO = '.(empty($conf->global->MAIN_SECURITY_HASH_ALGO) ? 'unset' : '')."   "; +print 'MAIN_SECURITY_HASH_ALGO = '.(empty($conf->global->MAIN_SECURITY_HASH_ALGO) ? $langs->trans("Undefined") : '')."   "; print '   If unset: \'md5\' '; print ' - Recommanded value: \'password_hash\'
'; -print 'MAIN_SECURITY_SALT = '.$conf->global->MAIN_SECURITY_SALT.'
'; +print 'MAIN_SECURITY_SALT = '.(empty($conf->global->MAIN_SECURITY_SALT) ? $langs->trans("Undefined") : '').'
'; print '
'; // TODO print ''.$langs->trans("AntivirusEnabledOnUpload").': '; +print empty($conf->global->MAIN_ANTIVIRUS_COMMAND) ? '' : img_picto('', 'tick').' '; print yn($conf->global->MAIN_ANTIVIRUS_COMMAND ? 1 : 0); if (!empty($conf->global->MAIN_ANTIVIRUS_COMMAND)) { print '   - '.$conf->global->MAIN_ANTIVIRUS_COMMAND; diff --git a/htdocs/admin/taxes.php b/htdocs/admin/taxes.php index 0963a264c52..4efc95061d4 100644 --- a/htdocs/admin/taxes.php +++ b/htdocs/admin/taxes.php @@ -65,7 +65,7 @@ if ($action == 'update') { $db->begin(); $res = dolibarr_set_const($db, 'TAX_MODE', $tax_mode, 'chaine', 0, '', $conf->entity); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; switch ($tax_mode) { @@ -90,13 +90,13 @@ if ($action == 'update') { } $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); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; $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); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; dolibarr_set_const($db, "MAIN_INFO_TVAINTRA", GETPOST("tva", 'alpha'), 'chaine', 0, '', $conf->entity); diff --git a/htdocs/admin/ticket.php b/htdocs/admin/ticket.php index f7e72f53e7e..690fee6a222 100644 --- a/htdocs/admin/ticket.php +++ b/htdocs/admin/ticket.php @@ -59,7 +59,7 @@ if ($action == 'updateMask') { $res = dolibarr_set_const($db, $maskconstticket, $maskticket, 'chaine', 0, '', $conf->entity); } - if (!$res > 0) { + if (!($res > 0)) { $error++; } @@ -113,7 +113,7 @@ elseif ($action == 'setmod') { } else { $res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_EMAIL_FROM', '', 'chaine', 0, '', $conf->entity); } - if (!$res > 0) { + if (!($res > 0)) { $error++; } @@ -124,7 +124,7 @@ elseif ($action == 'setmod') { } else { $res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_EMAIL_TO', '', 'chaine', 0, '', $conf->entity); } - if (!$res > 0) { + if (!($res > 0)) { $error++; } @@ -134,7 +134,7 @@ elseif ($action == 'setmod') { } else { $res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_INTRO', $langs->trans('TicketMessageMailIntroText'), 'chaine', 0, '', $conf->entity); } - if (!$res > 0) { + if (!($res > 0)) { $error++; } @@ -144,7 +144,7 @@ elseif ($action == 'setmod') { } else { $res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_SIGNATURE', $langs->trans('TicketMessageMailSignatureText'), 'chaine', 0, '', $conf->entity); } - if (!$res > 0) { + if (!($res > 0)) { $error++; } } @@ -152,13 +152,13 @@ elseif ($action == 'setmod') { if ($action == 'setvarother') { $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); - if (!$res > 0) { + if (!($res > 0)) { $error++; } $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); - if (!$res > 0) { + if (!($res > 0)) { $error++; } @@ -166,7 +166,7 @@ if ($action == 'setvarother') { { $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); - if (!$res > 0) { + if (!($res > 0)) { $error++; } } @@ -175,20 +175,20 @@ if ($action == 'setvarother') { { $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); - if (!$res > 0) { + if (!($res > 0)) { $error++; } } $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); - if (!$res > 0) { + if (!($res > 0)) { $error++; } $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); - if (!$res > 0) { + if (!($res > 0)) { $error++; } } diff --git a/htdocs/admin/ticket_public.php b/htdocs/admin/ticket_public.php index 80f458a2b5c..2bbf620b3c6 100644 --- a/htdocs/admin/ticket_public.php +++ b/htdocs/admin/ticket_public.php @@ -63,7 +63,7 @@ if ($action == 'setvar') { } else { $res = dolibarr_set_const($db, 'TICKET_PUBLIC_INTERFACE_TOPIC', '', 'chaine', 0, '', $conf->entity); } - if (!$res > 0) { + if (!($res > 0)) { $error++; } @@ -73,7 +73,7 @@ if ($action == 'setvar') { } else { $res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HOME', $langs->trans('TicketPublicInterfaceTextHome'), 'chaine', 0, '', $conf->entity); } - if (!$res > 0) { + if (!($res > 0)) { $error++; } @@ -83,7 +83,7 @@ if ($action == 'setvar') { } else { $res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HELP_MESSAGE', $langs->trans('TicketPublicPleaseBeAccuratelyDescribe'), 'chaine', 0, '', $conf->entity); } - if (!$res > 0) { + if (!($res > 0)) { $error++; } @@ -93,7 +93,7 @@ if ($action == 'setvar') { } else { $res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_NEW', $langs->trans('TicketMessageMailNewText'), 'chaine', 0, '', $conf->entity); } - if (!$res > 0) { + if (!($res > 0)) { $error++; } @@ -103,13 +103,13 @@ if ($action == 'setvar') { } else { $res = dolibarr_set_const($db, 'TICKET_URL_PUBLIC_INTERFACE', '', 'chaine', 0, '', $conf->entity); } - if (!$res > 0) { + if (!($res > 0)) { $error++; } $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); - if (!$res > 0) { + if (!($res > 0)) { $error++; } } @@ -117,25 +117,25 @@ if ($action == 'setvar') { if ($action == 'setvarother') { $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); - if (!$res > 0) { + if (!($res > 0)) { $error++; } $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); - if (!$res > 0) { + if (!($res > 0)) { $error++; } $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); - if (!$res > 0) { + if (!($res > 0)) { $error++; } $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); - if (!$res > 0) { + if (!($res > 0)) { $error++; } @@ -143,7 +143,7 @@ if ($action == 'setvarother') { { $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); - if (!$res > 0) { + if (!($res > 0)) { $error++; } } diff --git a/htdocs/admin/tools/export.php b/htdocs/admin/tools/export.php index 0c3679c62fa..b2fd7f5c2ee 100644 --- a/htdocs/admin/tools/export.php +++ b/htdocs/admin/tools/export.php @@ -80,7 +80,7 @@ $_SESSION["commandbackuptorun"] = ''; $_SESSION["commandbackupresult"] = ''; // 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)) { $err = error_reporting(); @@ -95,8 +95,6 @@ if (!empty($MemoryLimit)) @ini_set('memory_limit', $MemoryLimit); } -$form = new Form($db); -$formfile = new FormFile($db); //$help_url='EN:Backups|FR:Sauvegardes|ES:Copias_de_seguridad'; //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").'
'.$langs->trans("ToBuildBackupFileClickHere",DOL_URL_ROOT.'/admin/tools/dolibarr_export.php')),0,$langs->trans("PreviousDumpFiles")); - -print '
'; -*/ - // Redirect to backup page header("Location: dolibarr_export.php".(GETPOST('page_y', 'int') ? '?page_y='.GETPOST('page_y', 'int') : '')); -$time_end = time(); - $db->close(); diff --git a/htdocs/admin/website.php b/htdocs/admin/website.php index 0ca4be65910..3ebbd9300bc 100644 --- a/htdocs/admin/website.php +++ b/htdocs/admin/website.php @@ -435,9 +435,6 @@ if ($id) // Form to add a new line if ($tabname[$id]) { - $alabelisused = 0; - $var = false; - $fieldlist = explode(',', $tabfield[$id]); // Line for title @@ -461,7 +458,6 @@ if ($id) } else print $valuetoshow; print ''; } - if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') $alabelisused = 1; } print ''; // Line to enter new values - print ""; + print ''; $obj = new stdClass(); // If data was already input, we define them in obj to populate input fields. @@ -570,7 +566,7 @@ if ($id) print ' '; } else { $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 $error = $hookmanager->error; $errors = $hookmanager->errors; diff --git a/htdocs/admin/workstation.php b/htdocs/admin/workstation.php index 502a573e98b..98d72bf9f00 100755 --- a/htdocs/admin/workstation.php +++ b/htdocs/admin/workstation.php @@ -67,7 +67,7 @@ if ($action == 'updateMask') if ($maskconstorder) $res = dolibarr_set_const($db, $maskconstorder, $maskorder, 'chaine', 0, '', $conf->entity); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; if (!$error) { diff --git a/htdocs/api/class/api_documents.class.php b/htdocs/api/class/api_documents.class.php index 2d6a598398c..ebeeac5c5b9 100644 --- a/htdocs/api/class/api_documents.class.php +++ b/htdocs/api/class/api_documents.class.php @@ -425,7 +425,7 @@ class Documents extends DolibarrApi 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') { diff --git a/htdocs/barcode/printsheet.php b/htdocs/barcode/printsheet.php index 8a513034a4a..2a3a13cca69 100644 --- a/htdocs/barcode/printsheet.php +++ b/htdocs/barcode/printsheet.php @@ -22,6 +22,11 @@ * \ingroup member * \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_once DOL_DOCUMENT_ROOT.'/core/lib/format_cards.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'; - 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) - { - dol_print_error('', $result); - } + if ($result <= 0 || $mesg) { + if (empty($mesg)) { + $mesg = 'Error '.$result; + } - if (!$mesg) - { + setEventMessages($mesg, null, 'errors'); + } else { $db->close(); exit; } @@ -275,10 +286,10 @@ dol_htmloutput_errors($mesg); //print img_picto('','puce').' '.$langs->trans("PrintsheetForOneBarCode").'
'; //print '
'; -print ''; +print ''; // The target is for brothers that open the file instead of downloading it print ''; print ''; -print ''; +print ''; // The page will not renew the token but force download of a file, so we must use here currentToken print '
'; diff --git a/htdocs/bookmarks/admin/bookmark.php b/htdocs/bookmarks/admin/bookmark.php index c049d4af16f..5f30db5d7f2 100644 --- a/htdocs/bookmarks/admin/bookmark.php +++ b/htdocs/bookmarks/admin/bookmark.php @@ -38,7 +38,7 @@ if ($action == 'setvalue') { $showmenu = GETPOST('BOOKMARKS_SHOW_IN_MENU', 'alpha'); $res = dolibarr_set_const($db, "BOOKMARKS_SHOW_IN_MENU", $showmenu, 'chaine', 0, '', $conf->entity); - if (!$res > 0) { + if (!($res > 0)) { $error++; } diff --git a/htdocs/cashdesk/admin/cashdesk.php b/htdocs/cashdesk/admin/cashdesk.php index 5f0e9baddf5..21e10c05fc7 100644 --- a/htdocs/cashdesk/admin/cashdesk.php +++ b/htdocs/cashdesk/admin/cashdesk.php @@ -62,7 +62,7 @@ if (GETPOST('action', 'alpha') == 'set') dol_syslog("admin/cashdesk: level ".GETPOST('level', 'alpha')); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; if (!$error) { diff --git a/htdocs/cashdesk/validation_verif.php b/htdocs/cashdesk/validation_verif.php index 9468c395756..1df6f805ff6 100644 --- a/htdocs/cashdesk/validation_verif.php +++ b/htdocs/cashdesk/validation_verif.php @@ -318,7 +318,7 @@ switch ($action) if ($invoice->total_ttc == $obj_facturation->amountWithTax() && $obj_facturation->getSetPaymentMode() != 'DIFF') { - // We set status to payed + // We set status to paid $result = $invoice->set_paid($user); //print 'set paid';exit; } diff --git a/htdocs/collab/index.php b/htdocs/collab/index.php index 7353ea881ee..e5fe22c9168 100644 --- a/htdocs/collab/index.php +++ b/htdocs/collab/index.php @@ -114,7 +114,7 @@ if ($action == 'delete') if ($res > 0) { $res = $objectpage->delete($user); - if (!$res > 0) + if (!($res > 0)) { $error++; setEventMessages($objectpage->error, $objectpage->errors, 'errors'); diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 6499db671cb..6f1e83103d5 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -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 // 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')); - $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')); + $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'), 'tzuser'); // Check parameters if (!$datef && $percentage == 100) @@ -479,8 +479,8 @@ if (empty($reshook) && $action == 'update') $object->fetch_userassigned(); $object->oldcopy = clone $object; - $datep = dol_mktime($fulldayevent ? '00' : $aphour, $fulldayevent ? '00' : $apmin, 0, GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int')); - $datef = dol_mktime($fulldayevent ? '23' : $p2hour, $fulldayevent ? '59' : $p2min, $fulldayevent ? '59' : '0', GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", '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'), 'tzuser'); $object->type_id = dol_getIdFromCode($db, GETPOST("actioncode", 'aZ09'), 'c_actioncomm'); $object->label = GETPOST("label", "alphanohtml"); @@ -953,7 +953,7 @@ if ($action == 'create') // Full day print '
'; - $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); $datef = ($datef ? $datef : $object->datef); 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 - $datep = dol_mktime($fulldayevent ? '00' : $aphour, $fulldayevent ? '00' : $apmin, 0, GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int')); - $datef = dol_mktime($fulldayevent ? '23' : $p2hour, $fulldayevent ? '59' : $p2min, $fulldayevent ? '59' : '0', GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", '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'), 'tzuser'); $object->type_id = dol_getIdFromCode($db, GETPOST("actioncode", 'aZ09'), 'c_actioncomm'); $object->label = GETPOST("label", "alphanohtml"); @@ -1430,23 +1430,23 @@ if ($id > 0) // Full day event print ''; - + print dol_print_date($object->datep, 'dayhour', 'gmt'); // Date start - end print ''; @@ -1884,16 +1884,16 @@ if ($id > 0) // Date start print ''; print ''; // Date end print ''; diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 5a9b0afa336..f7e0ef6acb1 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1222,13 +1222,20 @@ class ActionComm extends CommonObject } $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->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 .= " WHERE 1 = 1"; if (empty($load_state_board)) $sql .= " AND a.percent >= 0 AND a.percent < 100"; $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->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); if ($resql) diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 016201be0f3..5396454667b 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -514,7 +514,7 @@ if (!empty($conf->use_javascript_ajax)) // If javascript on { $s .= ''."\n"; diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 23b5c47e474..045ab92f08e 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1952,12 +1952,12 @@ class ExtraFields $extrafield_collapse_display_value = intval($extrafield_param_list[0]); if ($extrafield_collapse_display_value == 1 || $extrafield_collapse_display_value == 2) { // Set the collapse_display status to cookie in priority or if ignorecollapsesetup is 1, if cookie and ignorecollapsesetup not defined, use the setup. - $collapse_display = ((isset($_COOKIE['DOLCOLLAPSE_'.$object->table_element.'_extrafields_'.$key.(!empty($object->id)?'_'.$object->id:'')]) || GETPOST('ignorecollapsesetup', 'int')) ? ($_COOKIE['DOLCOLLAPSE_'.$object->table_element.'_extrafields_'.$key.(!empty($object->id)?'_'.$object->id:'')] ? true : false) : ($extrafield_collapse_display_value == 2 ? false : true)); + $collapse_display = ((isset($_COOKIE['DOLCOLLAPSE_'.$object->table_element.'_extrafields_'.$key]) || GETPOST('ignorecollapsesetup', 'int')) ? ($_COOKIE['DOLCOLLAPSE_'.$object->table_element.'_extrafields_'.$key] ? true : false) : ($extrafield_collapse_display_value == 2 ? false : true)); $extrafields_collapse_num = $this->attributes[$object->table_element]['pos'][$key].(!empty($object->id)?'_'.$object->id:''); - $out .= ''; - $out .= ''; + $out .= ' });'."\n"; + $out .= ' });'."\n"; + $out .= '});'."\n"; + $out .= ''."\n"; } } } @@ -2030,9 +2031,12 @@ class ExtraFields if ($this->attributes[$object->table_element]['required'][$key]) // Value is required { - // Check if empty without using GETPOST, value can be alpha, int, array, etc... - if ((!is_array($_POST["options_".$key]) && empty($_POST["options_".$key]) && $this->attributes[$object->table_element]['type'][$key] != 'select' && $_POST["options_".$key] != '0') - || (!is_array($_POST["options_".$key]) && empty($_POST["options_".$key]) && $this->attributes[$object->table_element]['type'][$key] == 'select') + // Check if functionally empty without using GETPOST (depending on the type of extrafield, a + // technically non-empty value may be treated as empty functionally). + // value can be alpha, int, array, etc... + if ((!is_array($_POST["options_".$key]) && empty($_POST["options_".$key]) && $this->attributes[$object->table_element]['type'][$key] != 'select' && $_POST["options_".$key] != '0') + || (!is_array($_POST["options_".$key]) && empty($_POST["options_".$key]) && $this->attributes[$object->table_element]['type'][$key] == 'select') + || (!is_array($_POST["options_".$key]) && isset($_POST["options_".$key]) && $this->attributes[$object->table_element]['type'][$key] == 'sellist' && $_POST['options_'.$key] == '0') || (is_array($_POST["options_".$key]) && empty($_POST["options_".$key]))) { //print 'ccc'.$value.'-'.$this->attributes[$object->table_element]['required'][$key]; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 3bb3afae852..f2051aebba5 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1448,7 +1448,7 @@ class Form * @param string $htmlid Html id to use instead of htmlname * @param bool $multiple add [] in the name of element and add 'multiple' attribut * @param integer $disableifempty Set tag 'disabled' on select if there is no choice - * @return int <0 if KO, Nb of contact in list if OK + * @return int|string <0 if KO, HTML with select string if OK. */ public function selectcontacts($socid, $selected = '', $htmlname = 'contactid', $showempty = 0, $exclude = '', $limitto = '', $showfunction = 0, $moreclass = '', $options_only = false, $showsoc = 0, $forcecombo = 0, $events = array(), $moreparam = '', $htmlid = '', $multiple = false, $disableifempty = 0) { @@ -1927,7 +1927,7 @@ class Form * Return list of products for customer in Ajax if Ajax activated or go to select_produits_list * * @param int $selected Preselected products - * @param string $htmlname Name of HTML select field (must be unique in page) + * @param string $htmlname Name of HTML select field (must be unique in page). * @param int $filtertype Filter on product type (''=nofilter, 0=product, 1=service) * @param int $limit Limit on number of returned lines * @param int $price_level Level of price to show @@ -1949,7 +1949,7 @@ class Form * @param string $nooutput No print, return the output into a string * @return void|string */ - public function select_produits($selected = '', $htmlname = 'productid', $filtertype = '', $limit = 0, $price_level = 0, $status = 1, $finished = 2, $selected_input_value = '', $hidelabel = 0, $ajaxoptions = array(), $socid = 0, $showempty = '1', $forcecombo = 0, $morecss = '', $hidepriceinlabel = 0, $warehouseStatus = '', $selected_combinations = array(), $nooutput = 0) + public function select_produits($selected = '', $htmlname = 'productid', $filtertype = '', $limit = 0, $price_level = 0, $status = 1, $finished = 2, $selected_input_value = '', $hidelabel = 0, $ajaxoptions = array(), $socid = 0, $showempty = '1', $forcecombo = 0, $morecss = '', $hidepriceinlabel = 0, $warehouseStatus = '', $selected_combinations = null, $nooutput = 0) { // phpcs:enable global $langs, $conf; @@ -1997,10 +1997,13 @@ class Form } $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); - if (!empty($conf->variants->enabled)) { + if (!empty($conf->variants->enabled) && is_array($selected_combinations)) { + // Code to automatically insert with javascript the select of attributes under the select of product + // when a parent of variant has been selected. $out .= ' + '; diff --git a/htdocs/modulebuilder/template/admin/setup.php b/htdocs/modulebuilder/template/admin/setup.php index 417eb5a4e0f..e93b8686d79 100644 --- a/htdocs/modulebuilder/template/admin/setup.php +++ b/htdocs/modulebuilder/template/admin/setup.php @@ -83,10 +83,9 @@ if ($action == 'updateMask') { if ($maskconstorder) { $res = dolibarr_set_const($db, $maskconstorder, $maskorder, 'chaine', 0, '', $conf->entity); - } - - if (!$res > 0) { - $error++; + if (!($res > 0)) { + $error++; + } } if (!$error) { diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index 6ed5e2398bf..e22de010459 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -109,6 +109,7 @@ $search_array_options = $extrafields->getOptionalsFromPost($object->table_elemen // Default sort order (if not yet defined by previous GETPOST) if (!$sortfield) { + reset($object->fields); // Reset is required to avoid key() to return null. $sortfield = "t.".key($object->fields); // Set here default search field. By default 1st field in definition. } if (!$sortorder) { diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index 274782a14ea..121909eb28a 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -106,7 +106,7 @@ class Mo extends CommonObject 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>61, 'notnull'=>-1,), 'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>62, 'notnull'=>-1,), 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>500, 'notnull'=>1,), - 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'position'=>501, 'notnull'=>-1,), + 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'position'=>501, 'notnull'=>1,), 'date_valid' => array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-2, 'position'=>502,), 'fk_user_creat' => array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'position'=>510, 'notnull'=>1, 'foreignkey'=>'user.rowid',), 'fk_user_modif' => array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'position'=>511, 'notnull'=>-1,), @@ -1352,7 +1352,7 @@ class Mo extends CommonObject */ public static function replaceThirdparty($db, $origin_id, $dest_id) { - $tables = array('mrp_production'); + $tables = array('mrp_mo'); return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); } diff --git a/htdocs/paypal/admin/paypal.php b/htdocs/paypal/admin/paypal.php index 5ab913f7ce9..b16748f66b4 100644 --- a/htdocs/paypal/admin/paypal.php +++ b/htdocs/paypal/admin/paypal.php @@ -92,7 +92,7 @@ if ($action == "setlive") { $liveenable = GETPOST('value', 'int') ? 0 : 1; $res = dolibarr_set_const($db, "PAYPAL_API_SANDBOX", $liveenable, 'yesno', 0, '', $conf->entity); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); diff --git a/htdocs/paypal/lib/paypal.lib.php b/htdocs/paypal/lib/paypal.lib.php index 655d501cac3..873678adcae 100644 --- a/htdocs/paypal/lib/paypal.lib.php +++ b/htdocs/paypal/lib/paypal.lib.php @@ -105,7 +105,7 @@ function print_paypal_redirect($paymentAmount, $currencyCodeType, $paymentType, $landingPage = 'Billing'; } - dol_syslog("expresscheckout redirect with callSetExpressCheckout $paymentAmount, $currencyCodeType, $paymentType, $returnURL, $cancelURL, $tag, $solutionType, $landingPage, $shipToName, $shipToStreet, $shipToCity, $shipToState, $shipToCountryCode, $shipToZip, $shipToStreet2, $phoneNum"); + dol_syslog("print_paypal_redirect expresscheckout redirect with callSetExpressCheckout $paymentAmount, $currencyCodeType, $paymentType, $returnURL, $cancelURL, $tag, $solutionType, $landingPage, $shipToName, $shipToStreet, $shipToCity, $shipToState, $shipToCountryCode, $shipToZip, $shipToStreet2, $phoneNum"); $resArray = callSetExpressCheckout( $paymentAmount, $currencyCodeType, @@ -127,6 +127,8 @@ function print_paypal_redirect($paymentAmount, $currencyCodeType, $paymentType, $desc ); + dol_syslog("print_paypal_redirect resArray=".var_export($resArray, true), LOG_DEBUG); + $ack = strtoupper($resArray["ACK"]); if ($ack == "SUCCESS" || $ack == "SUCCESSWITHWARNING") { @@ -134,6 +136,7 @@ function print_paypal_redirect($paymentAmount, $currencyCodeType, $paymentType, // Redirect to paypal.com here $payPalURL = $API_Url.$token; + dol_syslog("Redirect to ".$payPalURL, LOG_INFO); header("Location: ".$payPalURL); exit; } else { @@ -282,7 +285,7 @@ function callSetExpressCheckout($paymentAmount, $currencyCodeType, $paymentType, $_SESSION["FinalPaymentAmt"] = $paymentAmount; $_SESSION["currencyCodeType"] = $currencyCodeType; $_SESSION["PaymentType"] = $paymentType; // 'Mark', 'Sole' - $_SESSION['ipaddress'] = $_SERVER['REMOTE_ADDR']; // Payer ip + $_SESSION['ipaddress'] = getUserRemoteIP(); // Payer ip //'--------------------------------------------------------------------------------------------------------------- //' Make the API call to PayPal @@ -433,7 +436,7 @@ function DirectPayment($paymentType, $paymentAmount, $creditCardType, $creditCar $nvpstr = $nvpstr . "&CITY=" . urlencode($city); $nvpstr = $nvpstr . "&STATE=" . urlencode($state); $nvpstr = $nvpstr . "&COUNTRYCODE=" . urlencode($countryCode); - $nvpstr = $nvpstr . "&IPADDRESS=" . $_SERVER['REMOTE_ADDR']; + $nvpstr = $nvpstr . "&IPADDRESS=" . getUserRemotIP(); $nvpstr = $nvpstr . "&INVNUM=" . urlencode($tag); $resArray=hash_call("DoDirectPayment", $nvpstr); diff --git a/htdocs/product/admin/product.php b/htdocs/product/admin/product.php index 25c5c8b1142..f268003e1bb 100644 --- a/htdocs/product/admin/product.php +++ b/htdocs/product/admin/product.php @@ -89,12 +89,12 @@ if ($action == 'setcodeproduct') if ($action == 'other' && GETPOST('value_PRODUIT_LIMIT_SIZE') >= 0) { $res = dolibarr_set_const($db, "PRODUIT_LIMIT_SIZE", GETPOST('value_PRODUIT_LIMIT_SIZE'), 'chaine', 0, '', $conf->entity); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; } if ($action == 'other' && GETPOST('value_PRODUIT_MULTIPRICES_LIMIT') > 0) { $res = dolibarr_set_const($db, "PRODUIT_MULTIPRICES_LIMIT", GETPOST('value_PRODUIT_MULTIPRICES_LIMIT'), 'chaine', 0, '', $conf->entity); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; } if ($action == 'other') { @@ -252,7 +252,7 @@ if ($action == 'set') $value = GETPOST('value'); if (GETPOST('value', 'alpha')) $res = dolibarr_set_const($db, $const, $value, 'chaine', 0, '', $conf->entity); else $res = dolibarr_del_const($db, $const, $conf->entity); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; } //if ($action == 'other') diff --git a/htdocs/product/card.php b/htdocs/product/card.php index c6dfd68d2c4..55c29aa1381 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -743,7 +743,7 @@ if (empty($reshook)) if (GETPOST('propalid') > 0) { // Define cost price for margin calculation $buyprice = 0; - if (($result = $propal->defineBuyPrice($pu_ht, GETPOST('remise_percent'), $object->id)) < 0) + if (($result = $propal->defineBuyPrice($pu_ht, price2num(GETPOST('remise_percent'), 2), $object->id)) < 0) { dol_syslog($langs->trans('FailedToGetCostPrice')); setEventMessages($langs->trans('FailedToGetCostPrice'), null, 'errors'); @@ -754,12 +754,12 @@ if (empty($reshook)) $result = $propal->addline( $desc, $pu_ht, - GETPOST('qty'), + price2num(GETPOST('qty'), 'MS'), $tva_tx, $localtax1_tx, // localtax1 $localtax2_tx, // localtax2 $object->id, - GETPOST('remise_percent'), + price2num(GETPOST('remise_percent'), 2), $price_base_type, $pu_ttc, 0, @@ -784,7 +784,7 @@ if (empty($reshook)) } elseif (GETPOST('commandeid') > 0) { // Define cost price for margin calculation $buyprice = 0; - if (($result = $commande->defineBuyPrice($pu_ht, GETPOST('remise_percent'), $object->id)) < 0) + if (($result = $commande->defineBuyPrice($pu_ht, GETPOST('remise_percent', 2), $object->id)) < 0) { dol_syslog($langs->trans('FailedToGetCostPrice')); setEventMessages($langs->trans('FailedToGetCostPrice'), null, 'errors'); @@ -795,12 +795,12 @@ if (empty($reshook)) $result = $commande->addline( $desc, $pu_ht, - GETPOST('qty'), + price2num(GETPOST('qty'), 'MS'), $tva_tx, $localtax1_tx, // localtax1 $localtax2_tx, // localtax2 $object->id, - GETPOST('remise_percent'), + price2num(GETPOST('remise_percent'), 2), '', '', $price_base_type, @@ -825,7 +825,7 @@ if (empty($reshook)) } elseif (GETPOST('factureid') > 0) { // Define cost price for margin calculation $buyprice = 0; - if (($result = $facture->defineBuyPrice($pu_ht, GETPOST('remise_percent'), $object->id)) < 0) + if (($result = $facture->defineBuyPrice($pu_ht, GETPOST('remise_percent', 2), $object->id)) < 0) { dol_syslog($langs->trans('FailedToGetCostPrice')); setEventMessages($langs->trans('FailedToGetCostPrice'), null, 'errors'); @@ -836,12 +836,12 @@ if (empty($reshook)) $result = $facture->addline( $desc, $pu_ht, - GETPOST('qty'), + price2nm(GETPOST('qty'), 'MS'), $tva_tx, $localtax1_tx, $localtax2_tx, $object->id, - GETPOST('remise_percent'), + price2num(GETPOST('remise_percent'), 2), '', '', '', diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 2aadd4b3813..88c5259f48d 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -160,7 +160,7 @@ if (empty($reshook)) if (empty($ref_fourn_old)) $ref_fourn_old = $ref_fourn; $quantity = price2num(GETPOST("qty", 'nohtml'), 'MS'); $remise_percent = price2num(GETPOST('remise_percent', 'alpha')); - $npr = preg_match('/\*/', $_POST['tva_tx']) ? 1 : 0; + $npr = preg_match('/\*/', GETPOST('tva_tx', 'alpha')) ? 1 : 0; $tva_tx = str_replace('*', '', GETPOST('tva_tx', 'alpha')); $tva_tx = price2num($tva_tx); $price_expression = GETPOST('eid', 'int') ? GETPOST('eid', 'int') : ''; // Discard expression if not in expression mode @@ -697,14 +697,14 @@ END; print ''; print ''; } // Discount qty min print ''; - print ''; print ''; diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 3785f50f213..89695690d38 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -419,10 +419,10 @@ if (empty($reshook)) // Récupération des variables $rowid = GETPOST('rowid', 'int'); $priceid = GETPOST('priceid', 'int'); - $newprice = price2num(GETPOST("price", 'alpha'), 'MU'); + $newprice = price2num(GETPOST("price"), 'MU'); // $newminprice=price2num(GETPOST("price_min"),'MU'); // TODO : Add min price management - $quantity = GETPOST('quantity', 'int'); - $remise_percent = price2num(GETPOST('remise_percent', 'alpha')); + $quantity = price2num(GETPOST('quantity'), 'MS'); + $remise_percent = price2num(GETPOST('remise_percent'), 2); $remise = 0; // TODO : allow discount by amount when available on documents if (empty($quantity)) { diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index f975eaabc67..ac3ce4636e6 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -119,24 +119,24 @@ class Entrepot extends CommonObject public $fields = array( 'rowid' =>array('type'=>'integer', 'label'=>'ID', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>10), 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'default'=>1, 'notnull'=>1, 'index'=>1, 'position'=>15), - 'ref' =>array('type'=>'varchar(255)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'showoncombobox'=>1, 'position'=>25), + 'ref' =>array('type'=>'varchar(255)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'showoncombobox'=>1, 'position'=>25, 'searchall'=>1), 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>30), - 'description' =>array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-2, 'position'=>35), - 'lieu' =>array('type'=>'varchar(64)', 'label'=>'LocationSummary', 'enabled'=>1, 'visible'=>1, 'position'=>40, 'showoncombobox'=>1), + 'description' =>array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-2, 'position'=>35, 'searchall'=>1), + 'lieu' =>array('type'=>'varchar(64)', 'label'=>'LocationSummary', 'enabled'=>1, 'visible'=>1, 'position'=>40, 'showoncombobox'=>1, 'searchall'=>1), 'fk_parent' =>array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php:1:statut=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ParentWarehouse', 'enabled'=>1, 'visible'=>-2, 'position'=>41), - 'address' =>array('type'=>'varchar(255)', 'label'=>'Address', 'enabled'=>1, 'visible'=>-2, 'position'=>45), - 'zip' =>array('type'=>'varchar(10)', 'label'=>'Zip', 'enabled'=>1, 'visible'=>-2, 'position'=>50), - 'town' =>array('type'=>'varchar(50)', 'label'=>'Town', 'enabled'=>1, 'visible'=>-2, 'position'=>55), + 'address' =>array('type'=>'varchar(255)', 'label'=>'Address', 'enabled'=>1, 'visible'=>-2, 'position'=>45, 'searchall'=>1), + 'zip' =>array('type'=>'varchar(10)', 'label'=>'Zip', 'enabled'=>1, 'visible'=>-2, 'position'=>50, 'searchall'=>1), + 'town' =>array('type'=>'varchar(50)', 'label'=>'Town', 'enabled'=>1, 'visible'=>-2, 'position'=>55, 'searchall'=>1), 'fk_departement' =>array('type'=>'sellist:c_departements:label:rowid::active=1', 'label'=>'State', 'enabled'=>1, 'visible'=>0, 'position'=>60), 'fk_pays' =>array('type'=>'sellist:c_country:label:rowid::active=1', 'label'=>'Country', 'enabled'=>1, 'visible'=>-2, 'position'=>65), - 'phone' =>array('type'=>'varchar(20)', 'label'=>'Phone', 'enabled'=>1, 'visible'=>-2, 'position'=>70), - 'fax' =>array('type'=>'varchar(20)', 'label'=>'Fax', 'enabled'=>1, 'visible'=>-2, 'position'=>75), + 'phone' =>array('type'=>'varchar(20)', 'label'=>'Phone', 'enabled'=>1, 'visible'=>-2, 'position'=>70, 'searchall'=>1), + 'fax' =>array('type'=>'varchar(20)', 'label'=>'Fax', 'enabled'=>1, 'visible'=>-2, 'position'=>75, 'searchall'=>1), //'fk_user_author' =>array('type'=>'integer', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-2, 'position'=>82), - 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>500), - 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>501), + 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>300), + 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>301), //'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000), //'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'ModelPDF', 'enabled'=>1, 'visible'=>0, 'position'=>1010), - 'statut' =>array('type'=>'tinyint(4)', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'position'=>200), + 'statut' =>array('type'=>'tinyint(4)', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'position'=>500), ); /** diff --git a/htdocs/product/stock/list.php b/htdocs/product/stock/list.php index 1470bdc2aa0..c823042eba0 100644 --- a/htdocs/product/stock/list.php +++ b/htdocs/product/stock/list.php @@ -86,18 +86,6 @@ $extrafields->fetch_name_optionals_label($object->table_element); $search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); -// List of fields to search into when doing a "search in all" -$fieldstosearchall = array( - 't.ref'=>"Ref", - 't.lieu'=>"LocationSummary", - 't.description'=>"Description", - 't.address'=>"Address", - 't.zip'=>'Zip', - 't.town'=>'Town', - 't.phone'=>'Phone', - 't.fax'=>'Fax', -); - // Initialize array of search criterias $search_all = GETPOST("search_all", 'alpha'); $search = array(); @@ -108,37 +96,39 @@ foreach ($object->fields as $key => $val) if (GETPOST('search_'.$search_key, 'alpha') !== '') $search[$search_key] = GETPOST('search_'.$search_key, 'alpha'); } -// Definition of fields for list -$arrayfields = array( - 'stockqty'=>array('type'=>'float', 'label'=>'PhysicalStock', 'enabled'=>1, 'visible'=>-2, 'position'=>70), - 'estimatedvalue'=>array('type'=>'float', 'label'=>'EstimatedStockValue', 'enabled'=>1, 'visible'=>-2, 'position'=>71), - 'estimatedstockvaluesell'=>array('type'=>'float', 'label'=>'EstimatedStockValueSell', 'enabled'=>1, 'visible'=>-2, 'position'=>72), -); +// List of fields to search into when doing a "search in all" +$fieldstosearchall = array(); foreach ($object->fields as $key => $val) { - // If $val['visible']==0, then we never show the field - if (!empty($val['visible'])) $arrayfields['t.'.$key] = array('label'=>$val['label'], 'checked'=>(($val['visible'] < 0) ? 0 : 1), 'enabled'=>($val['enabled'] && ($val['visible'] != 3)), 'position'=>$val['position']); + if ($val['searchall']) $fieldstosearchall['t.'.$key] = $val['label']; } -// Extra fields -if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) -{ - foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) - { - if (!empty($extrafields->attributes[$object->table_element]['list'][$key])) { - $arrayfields["ef.".$key] = array( - 'label'=>$extrafields->attributes[$object->table_element]['label'][$key], - 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), - 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], - 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key]) - ); - } + +// Definition of array of fields for columns +$arrayfields = array( + 'stockqty'=>array('type'=>'float', 'label'=>'PhysicalStock', 'enabled'=>1, 'visible'=>-2, 'checked'=>0, 'position'=>170), + 'estimatedvalue'=>array('type'=>'float', 'label'=>'EstimatedStockValue', 'enabled'=>1, 'visible'=>1, 'checked'=>1, 'position'=>171), + 'estimatedstockvaluesell'=>array('type'=>'float', 'label'=>'EstimatedStockValueSell', 'enabled'=>1, 'checked'=>1, 'visible'=>2, 'position'=>172), +); +foreach ($object->fields as $key => $val) { + // If $val['visible']==0, then we never show the field + if (!empty($val['visible'])) { + $visible = (int) dol_eval($val['visible'], 1); + $arrayfields['t.'.$key] = array( + 'label'=>$val['label'], + 'checked'=>(($visible < 0) ? 0 : 1), + 'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1)), + 'position'=>$val['position'], + 'help'=>$val['help'] + ); } } +// Extra fields +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; + $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); - /* * Actions */ diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 89df906feda..d1c1ea99ff7 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -636,13 +636,13 @@ if ($id > 0 || $ref) // Real stock $text_stock_options = $langs->trans("RealStockDesc").'
'; $text_stock_options .= $langs->trans("RealStockWillAutomaticallyWhen").'
'; - $text_stock_options .= (!empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) || !empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE) ? $langs->trans("DeStockOnShipment").'
' : ''); - $text_stock_options .= (!empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) ? $langs->trans("DeStockOnValidateOrder").'
' : ''); - $text_stock_options .= (!empty($conf->global->STOCK_CALCULATE_ON_BILL) ? $langs->trans("DeStockOnBill").'
' : ''); - $text_stock_options .= (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL) ? $langs->trans("ReStockOnBill").'
' : ''); - $text_stock_options .= (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER) ? $langs->trans("ReStockOnValidateOrder").'
' : ''); - $text_stock_options .= (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER) ? $langs->trans("ReStockOnDispatchOrder").'
' : ''); - $text_stock_options .= (!empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE) ? $langs->trans("StockOnReception").'
' : ''); + $text_stock_options .= (!empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) || !empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE) ? '- '.$langs->trans("DeStockOnShipment").'
' : ''); + $text_stock_options .= (!empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) ? '- '.$langs->trans("DeStockOnValidateOrder").'
' : ''); + $text_stock_options .= (!empty($conf->global->STOCK_CALCULATE_ON_BILL) ? '- '.$langs->trans("DeStockOnBill").'
' : ''); + $text_stock_options .= (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL) ? '- '.$langs->trans("ReStockOnBill").'
' : ''); + $text_stock_options .= (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER) ? '- '.$langs->trans("ReStockOnValidateOrder").'
' : ''); + $text_stock_options .= (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER) ? '- '.$langs->trans("ReStockOnDispatchOrder").'
' : ''); + $text_stock_options .= (!empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE) ? '- '.$langs->trans("StockOnReception").'
' : ''); print ''; else print '';*/ print ''; -print ''; +print ''; print ''; else print '';*/ print ''; -print ''; +print ''; foreach ($TWeek as $week_number) { diff --git a/htdocs/projet/activity/perweek.php b/htdocs/projet/activity/perweek.php index c29486302af..f001a73d0f4 100644 --- a/htdocs/projet/activity/perweek.php +++ b/htdocs/projet/activity/perweek.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2015 Laurent Destailleur * Copyright (C) 2005-2010 Regis Houssin * Copyright (C) 2010 François Legastelois - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018 Frédéric France * * 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 @@ -559,19 +559,19 @@ $moreforfilter .= '
'; $moreforfilter .= '
'; $includeonly = 'hierarchyme'; if (empty($user->rights->user->user->lire)) $includeonly = array($user->id); -$moreforfilter .= img_picto($langs->trans('User'), 'user').$form->select_dolusers($search_usertoprocessid ? $search_usertoprocessid : $usertoprocess->id, 'search_usertoprocessid', $user->rights->user->user->lire ? 0 : 0, null, 0, $includeonly, null, 0, 0, 0, '', 0, '', 'maxwidth200'); +$moreforfilter .= img_picto($langs->trans('Filter').' '.$langs->trans('User'), 'user').$form->select_dolusers($search_usertoprocessid ? $search_usertoprocessid : $usertoprocess->id, 'search_usertoprocessid', $user->rights->user->user->lire ? 0 : 0, null, 0, $includeonly, null, 0, 0, 0, '', 0, '', 'maxwidth200'); $moreforfilter .= '
'; if (empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)) { $moreforfilter .= '
'; $moreforfilter .= '
'; - $moreforfilter .= img_picto($langs->trans('Project'), 'project').''; + $moreforfilter .= img_picto($langs->trans('Filter').' '.$langs->trans('Project'), 'project').''; $moreforfilter .= '
'; $moreforfilter .= '
'; $moreforfilter .= '
'; - $moreforfilter .= img_picto($langs->trans('ThirdParty'), 'company').''; + $moreforfilter .= img_picto($langs->trans('Filter').' '.$langs->trans('ThirdParty'), 'company').''; $moreforfilter .= '
'; } @@ -652,7 +652,7 @@ if (!empty($arrayfields['t.progress']['checked'])) if ($usertoprocess->id == $user->id) print '
'; else print '';*/ print ''; -print ''; +print ''; for ($idw = 0; $idw < 7; $idw++) { diff --git a/htdocs/projet/admin/project.php b/htdocs/projet/admin/project.php index a46c64464f8..f36aae34c4f 100644 --- a/htdocs/projet/admin/project.php +++ b/htdocs/projet/admin/project.php @@ -58,7 +58,7 @@ if ($action == 'updateMask') if ($maskconstproject) $res = dolibarr_set_const($db, $maskconstproject, $maskproject, 'chaine', 0, '', $conf->entity); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; if (!$error) { @@ -75,7 +75,7 @@ if ($action == 'updateMaskTask') if ($maskconstmasktask) $res = dolibarr_set_const($db, $maskconstmasktask, $masktaskt, 'chaine', 0, '', $conf->entity); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; if (!$error) { diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index aa01ef5d3ef..6802d0e84a9 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -1361,7 +1361,6 @@ if ($conf->use_javascript_ajax) { include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; $comboenhancement = ajax_combobox('.elementselect'); - $out .= $comboenhancement; print $comboenhancement; } diff --git a/htdocs/projet/index.php b/htdocs/projet/index.php index 6c376fc35f3..f2b1820c019 100644 --- a/htdocs/projet/index.php +++ b/htdocs/projet/index.php @@ -322,7 +322,7 @@ $sql .= " WHERE p.entity IN (".getEntity('project').")"; $sql .= " AND p.fk_statut = 1"; if ($mine || empty($user->rights->projet->all->lire)) $sql .= " AND p.rowid IN (".$projectsListId.")"; // If we have this test true, it also means projectset is not 2 if ($socid) $sql .= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; -$sql .= " GROUP BY s.rowid, s.nom, s.email, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.canvas, s.status"; +$sql .= " GROUP BY s.rowid, s.nom, s.name_alias, s.code_client, s.code_compta, s.client, s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur, s.logo, s.email, s.entity, s.canvas, s.status"; $sql .= $db->order($sortfield, $sortorder); //$sql .= $db->plimit($max + 1, 0); diff --git a/htdocs/projet/info.php b/htdocs/projet/info.php index 5b408717f40..e87aa25dadb 100644 --- a/htdocs/projet/info.php +++ b/htdocs/projet/info.php @@ -160,7 +160,7 @@ $morehtmlcenter = ''; if (!empty($conf->agenda->enabled)) { $addActionBtnRight = !empty($user->rights->agenda->myactions->create) || !empty($user->rights->agenda->allactions->create); - $morehtmlcenter .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', $addActionBtnRight); + $morehtmlcenter .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out.'&socid='.$object->socid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', $addActionBtnRight); } //print ''; diff --git a/htdocs/projet/tasks/contact.php b/htdocs/projet/tasks/contact.php index 253c2c787e4..1b12bf166f2 100644 --- a/htdocs/projet/tasks/contact.php +++ b/htdocs/projet/tasks/contact.php @@ -57,11 +57,22 @@ $projectstatic = new Project($db); // Add new contact if ($action == 'addcontact' && $user->rights->projet->creer) { + $source = 'internal'; + if (GETPOST("addsourceexternal")) { + $source ='external'; + } + $result = $object->fetch($id, $ref); if ($result > 0 && $id > 0) { - $idfortaskuser = (GETPOST("contactid") != 0) ?GETPOST("contactid") : GETPOST("userid"); // GETPOST('contactid') may val -1 to mean empty or -2 to means "everybody" + if ($source == 'internal') { + $idfortaskuser = ((GETPOST("userid") != 0 && GETPOST('userid') != -1) ? GETPOST("userid") : 0); // GETPOST('contactid') may val -1 to mean empty or -2 to means "everybody" + $typeid = GETPOST('type'); + } else { + $idfortaskuser = ((GETPOST("contactid") > 0) ? GETPOST("contactid", 'int') : 0); // GETPOST('contactid') may val -1 to mean empty or -2 to means "everybody" + $typeid = GETPOST('typecontact'); + } if ($idfortaskuser == -2) { $result = $projectstatic->fetch($object->fk_project); @@ -72,13 +83,11 @@ if ($action == 'addcontact' && $user->rights->projet->creer) $contactsofproject = $projectstatic->getListContactId('internal'); foreach ($contactsofproject as $key => $val) { - $typeid = (GETPOST('typecontact') ? GETPOST('typecontact') : GETPOST('type')); - $result = $object->add_contact($val, $type, GETPOST("source", 'aZ09')); + $result = $object->add_contact($val, $typeid, $source); } } } else { - $typeid = (GETPOST('typecontact') ? GETPOST('typecontact') : GETPOST('type')); - $result = $object->add_contact($idfortaskuser, $typeid, GETPOST("source", 'aZ09')); + $result = $object->add_contact($idfortaskuser, $typeid, $source); } } @@ -353,6 +362,12 @@ if ($id > 0 || !empty($ref)) /* * Add a new contact line */ + print ''; + print ''; + print ''; + print ''; + if ($withproject) print ''; + print '
'.$key.''.$key.''.$langs->trans("Value").'
"; - - if (in_array($name, $list)) - { - if ($name == 'xdebug') $html .= ''; - else $html .= ''; - } else { - if ($name == 'xdebug') $html .= yn(0); - else $html .= ''; - } - - $html .= "-"; - - foreach ($functions as $function) - { - $result = $result && function_exists($function); - } - - if ($result) - { - $html .= 'Ok'; - } else { - $html .= 'Warning'; - } - - $html .= ""; - $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 .= "'; @@ -469,7 +465,7 @@ if ($id) print '
'.$langs->trans("EventOnFullDay").'
'.$langs->trans("EventOnFullDay").'fulldayevent ? ' checked' : '').'>
'.$langs->trans("DateActionStart").' - '.$langs->trans("DateActionEnd").''; 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) { - 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 { - 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 ' - '; 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) { - 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 { - 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 '
'.$langs->trans("DateActionStart").''; - if (!$object->fulldayevent) print dol_print_date($object->datep, 'dayhour'); - else print dol_print_date($object->datep, 'day'); + if (!$object->fulldayevent) print dol_print_date($object->datep, 'dayhour', 'tzuser'); + 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")); print '
'.$langs->trans("DateActionEnd").''; - if (!$object->fulldayevent) print dol_print_date($object->datef, 'dayhour'); - else print dol_print_date($object->datef, 'day'); + if (!$object->fulldayevent) print dol_print_date($object->datef, 'dayhour', 'tzuser'); + 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")); print '
'.$langs->trans("PriceQtyMin").''; print ' '; - print $form->selectPriceBaseType((GETPOST('price_base_type') ? GETPOST('price_base_type') : 'HT'), "price_base_type"); // We keep 'HT' here, price_base_type is not yet supported for supplier prices + print $form->selectPriceBaseType((GETPOSTISSET('price_base_type') ? GETPOST('price_base_type') : 'HT'), "price_base_type"); // We keep 'HT' here, price_base_type is not yet supported for supplier prices print '
'.$langs->trans("DiscountQtyMin").' %'; + print ' %'; print '
'; print $form->textwithpicto($langs->trans("PhysicalStock"), $text_stock_options, 1); diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index ed537f1bd4e..64dd485671d 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -538,9 +538,9 @@ print dol_get_fiche_head($head, 'replenish', '', -1, ''); print ''.$langs->trans("ReplenishmentStatusDesc").''."\n"; if (empty($fk_warhouse) && !empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE)) { - print ''.$langs->trans("ReplenishmentStatusDescPerWarehouse").''."
\n"; + print ''.$langs->trans("ReplenishmentStatusDescPerWarehouse").''."\n"; } -print '
'; +print '

'; if ($usevirtualstock == 1) { print $langs->trans("CurentSelectionMode").': '; diff --git a/htdocs/projet/activity/perday.php b/htdocs/projet/activity/perday.php index a4a37f22a31..c6b38390ac9 100644 --- a/htdocs/projet/activity/perday.php +++ b/htdocs/projet/activity/perday.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2005-2010 Regis Houssin * Copyright (C) 2010 François Legastelois - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018 Frédéric France * * 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 @@ -504,19 +504,19 @@ $moreforfilter .= '
'; $moreforfilter .= '
'; $includeonly = 'hierarchyme'; if (empty($user->rights->user->user->lire)) $includeonly = array($user->id); -$moreforfilter .= img_picto($langs->trans('User'), 'user').$form->select_dolusers($search_usertoprocessid ? $search_usertoprocessid : $usertoprocess->id, 'search_usertoprocessid', $user->rights->user->user->lire ? 0 : 0, null, 0, $includeonly, null, 0, 0, 0, '', 0, '', 'maxwidth200 marginleftonly'); +$moreforfilter .= img_picto($langs->trans('Filter').' '.$langs->trans('User'), 'user').$form->select_dolusers($search_usertoprocessid ? $search_usertoprocessid : $usertoprocess->id, 'search_usertoprocessid', $user->rights->user->user->lire ? 0 : 0, null, 0, $includeonly, null, 0, 0, 0, '', 0, '', 'maxwidth200 marginleftonly'); $moreforfilter .= '
'; if (empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)) { $moreforfilter .= '
'; $moreforfilter .= '
'; - $moreforfilter .= img_picto($langs->trans('Project'), 'project').''; + $moreforfilter .= img_picto($langs->trans('Filter').' '.$langs->trans('Project'), 'project').''; $moreforfilter .= '
'; $moreforfilter .= '
'; $moreforfilter .= '
'; - $moreforfilter .= img_picto($langs->trans('ThirdParty'), 'company').''; + $moreforfilter .= img_picto($langs->trans('Filter').' '.$langs->trans('ThirdParty'), 'company').''; $moreforfilter .= '
'; } @@ -594,7 +594,7 @@ if (!empty($arrayfields['t.progress']['checked'])) if ($usertoprocess->id == $user->id) print '
'.$langs->trans("TimeSpentByYou").''.$langs->trans("TimeSpentByUser").''.$langs->trans("TimeSpent").'
'.$langs->trans("Everybody").'
'.$langs->trans("TimeSpent").($usertoprocess->firstname ? '
'.dol_trunc($usertoprocess->firstname, 10).'' : '').'
'.$langs->trans("TimeSpent").($usertoprocess->firstname ? '
'.$usertoprocess->getNomUrl(-2).''.dol_trunc($usertoprocess->firstname, 10).'' : '').'
'.$langs->trans("HourStart").''; // By default, we can edit only tasks we are assigned to diff --git a/htdocs/projet/activity/permonth.php b/htdocs/projet/activity/permonth.php index 9a95f8abf79..626634b13cd 100644 --- a/htdocs/projet/activity/permonth.php +++ b/htdocs/projet/activity/permonth.php @@ -429,19 +429,19 @@ $moreforfilter .= '
'; $moreforfilter .= '
'; $includeonly = 'hierachyme'; if (empty($user->rights->user->user->lire)) $includeonly = array($user->id); -$moreforfilter .= img_picto($langs->trans('User'), 'user').$form->select_dolusers($search_usertoprocessid ? $search_usertoprocessid : $usertoprocess->id, 'search_usertoprocessid', $user->rights->user->user->lire ? 0 : 0, null, 0, $includeonly, null, 0, 0, 0, '', 0, '', 'maxwidth200'); +$moreforfilter .= img_picto($langs->trans('Filter').' '.$langs->trans('User'), 'user').$form->select_dolusers($search_usertoprocessid ? $search_usertoprocessid : $usertoprocess->id, 'search_usertoprocessid', $user->rights->user->user->lire ? 0 : 0, null, 0, $includeonly, null, 0, 0, 0, '', 0, '', 'maxwidth200'); $moreforfilter .= '
'; if (empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)) { $moreforfilter .= '
'; $moreforfilter .= '
'; - $moreforfilter .= img_picto($langs->trans('Project'), 'project').''; + $moreforfilter .= img_picto($langs->trans('Filter').' '.$langs->trans('Project'), 'project').''; $moreforfilter .= '
'; $moreforfilter .= '
'; $moreforfilter .= '
'; - $moreforfilter .= img_picto($langs->trans('ThirdParty'), 'company').''; + $moreforfilter .= img_picto($langs->trans('Filter').' '.$langs->trans('ThirdParty'), 'company').''; $moreforfilter .= '
'; } @@ -488,7 +488,7 @@ print '
'.$langs->trans("ProgressDeclared"). if ($usertoprocess->id == $user->id) print ''.$langs->trans("TimeSpentByYou").''.$langs->trans("TimeSpentByUser").''.$langs->trans("TimeSpent").'
'.$langs->trans("Everybody").'
'.$langs->trans("TimeSpent").($usertoprocess->firstname ? '
'.dol_trunc($usertoprocess->firstname, 10).'' : '').'
'.$langs->trans("TimeSpent").($usertoprocess->firstname ? '
'.$usertoprocess->getNomUrl(-2).''.dol_trunc($usertoprocess->firstname, 10).'' : '').'
'.$langs->trans("TimeSpentByYou").''.$langs->trans("TimeSpentByUser").''.$langs->trans("TimeSpent").'
'.$langs->trans("Everybody").'
'.$langs->trans("TimeSpent").($usertoprocess->firstname ? '
'.dol_trunc($usertoprocess->firstname, 10).'' : '').'
'.$langs->trans("TimeSpent").($usertoprocess->firstname ? '
'.$usertoprocess->getNomUrl(-2).''.dol_trunc($usertoprocess->firstname, 10).'' : '').'
'; if ($action != 'editline' && $user->rights->projet->creer) @@ -365,13 +380,6 @@ if ($id > 0 || !empty($ref)) print ''; print "\n"; - print ''; - print ''; - print ''; - print ''; - print ''; - if ($withproject) print ''; - // Ligne ajout pour contact interne print ''; @@ -387,26 +395,17 @@ if ($id > 0 || !empty($ref)) // On recupere les id des users deja selectionnes if ($object->project->public) $contactsofproject = ''; // Everybody else $contactsofproject = $projectstatic->getListContactId('internal'); - print $form->select_dolusers((GETPOST('contactid') ?GETPOST('contactid') : $user->id), 'contactid', 0, '', 0, '', $contactsofproject, 0, 0, 0, '', 1, $langs->trans("ResourceNotAssignedToProject")); + print $form->select_dolusers((GETPOSTISSET('userid') ? GETPOST('userid', 'int') : $user->id), 'userid', 0, '', 0, '', $contactsofproject, 0, 0, 0, '', 1, $langs->trans("ResourceNotAssignedToProject")); print ''; print ''; - print ''; + print ''; print ''; - print ''; - // Line to add an external contact. Only if project linked to a third party. if ($projectstatic->socid) { - print ''; - print ''; - print ''; - print ''; - print ''; - if ($withproject) print ''; - print ''; print ''; print ''; - print ''; print ''; - - print ""; } } @@ -535,6 +532,8 @@ if ($id > 0 || !empty($ref)) } } print "
 
'; $formcompany->selectTypeContact($object, '', 'type', 'internal', 'rowid'); print '
'; @@ -421,18 +420,16 @@ if ($id > 0 || !empty($ref)) print ''; $contactofproject = $projectstatic->getListContactId('external'); - print $form->selectcontacts($selectedCompany, '', 'contactid', 0, '', $contactofproject); + print $form->selectcontacts($selectedCompany, '', 'contactid', 0, '', $contactofproject, 0, '', false, 0, 0); $nbofcontacts = $form->num; print ''; - $formcompany->selectTypeContact($object, '', 'type', 'external', 'rowid'); + $formcompany->selectTypeContact($object, '', 'typecontact', 'external', 'rowid'); print '
"; + + print ""; } else { print "ErrorRecordNotFound"; } diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 1a643323dce..8672fa1c2bf 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -1855,7 +1855,7 @@ if (preg_match('/^dopayment/', $action)) // If we choosed/click on the payment { $noidempotency_key = (GETPOSTISSET('noidempotency') ? GETPOST('noidempotency', 'int') : 0); // By default noidempotency is unset, so we must use a different tag/ref for each payment. If set, we can pay several times the same tag/ref. $paymentintent = $stripe->getPaymentIntent($amount, $currency, $tag, 'Stripe payment: '.$fulltag.(is_object($object) ? ' ref='.$object->ref : ''), $object, $stripecu, $stripeacc, $servicestatus, 0, 'automatic', false, null, 0, $noidempotency_key); - // The paymentintnent has status 'requires_payment_method' (even if paymentintent was already payed) + // The paymentintnent has status 'requires_payment_method' (even if paymentintent was already paid) //var_dump($paymentintent); if ($stripe->error) setEventMessages($stripe->error, null, 'errors'); } diff --git a/htdocs/public/payment/paymentko.php b/htdocs/public/payment/paymentko.php index ac92c958931..b99c4a39392 100644 --- a/htdocs/public/payment/paymentko.php +++ b/htdocs/public/payment/paymentko.php @@ -31,7 +31,7 @@ if (!defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined if (!defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // For MultiCompany module. -// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php +// Do not use GETPOST here, function is not defined and this test must be done before including main.inc.php // TODO This should be useless. Because entity must be retrieve from object ref and not from url. $entity = (!empty($_GET['e']) ? (int) $_GET['e'] : (!empty($_POST['e']) ? (int) $_POST['e'] : 1)); if (is_numeric($entity)) define("DOLENTITY", $entity); diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index ef4931c4b4a..f4b9f0feb5b 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -409,7 +409,7 @@ if ($ispaymentok) $postactionmessages[] = $errmsg; $ispostactionok = -1; } else { - $postactionmessages[] = 'Subscription created'; + $postactionmessages[] = 'Subscription created (id='.$crowid.')'; $ispostactionok = 1; } } @@ -614,7 +614,7 @@ if ($ispaymentok) $ispostactionok = -1; } } else { - $postactionmessages[] = 'Member '.$tmptag['MEM'].' for subscription payed was not found'; + $postactionmessages[] = 'Member '.$tmptag['MEM'].' for subscription paid was not found'; $ispostactionok = -1; } } elseif (array_key_exists('INV', $tmptag) && $tmptag['INV'] > 0) @@ -718,7 +718,7 @@ if ($ispaymentok) $ispostactionok = -1; } } else { - $postactionmessages[] = 'Invoice payed '.$tmptag['INV'].' was not found'; + $postactionmessages[] = 'Invoice paid '.$tmptag['INV'].' was not found'; $ispostactionok = -1; } } else { diff --git a/htdocs/public/stripe/ipn.php b/htdocs/public/stripe/ipn.php index bfb1bc99c5a..0b5f14c9217 100644 --- a/htdocs/public/stripe/ipn.php +++ b/htdocs/public/stripe/ipn.php @@ -361,7 +361,7 @@ if ($event->type == 'payout.created') { } } elseif ($event->type == 'payment_method.detached') { $db->begin(); - $sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_rib WHERE ref = '".$db->escape($event->data->object->id)."' and status = ".$servicestatus; + $sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_rib WHERE number = '".$db->escape($event->data->object->id)."' and status = ".$servicestatus; $db->query($sql); $db->commit(); } elseif ($event->type == 'charge.succeeded') { diff --git a/htdocs/recruitment/admin/public_interface.php b/htdocs/recruitment/admin/public_interface.php index a457c2a4427..31925608811 100644 --- a/htdocs/recruitment/admin/public_interface.php +++ b/htdocs/recruitment/admin/public_interface.php @@ -52,7 +52,7 @@ if ($action == 'update') { $res = dolibarr_set_const($db, "RECRUITMENT_ENABLE_PUBLIC_INTERFACE", $public, 'chaine', 0, '', $conf->entity); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); diff --git a/htdocs/recruitment/admin/setup.php b/htdocs/recruitment/admin/setup.php index 342d32840c5..1c2d76ffd40 100644 --- a/htdocs/recruitment/admin/setup.php +++ b/htdocs/recruitment/admin/setup.php @@ -83,7 +83,7 @@ if ($action == 'updateMask') if ($maskconstorder) $res = dolibarr_set_const($db, $maskconstorder, $maskorder, 'chaine', 0, '', $conf->entity); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; if (!$error) { diff --git a/htdocs/recruitment/admin/setup_candidatures.php b/htdocs/recruitment/admin/setup_candidatures.php index 818e1479f0a..9bc3cd96d5a 100644 --- a/htdocs/recruitment/admin/setup_candidatures.php +++ b/htdocs/recruitment/admin/setup_candidatures.php @@ -83,7 +83,7 @@ if ($action == 'updateMask') if ($maskconstorder) $res = dolibarr_set_const($db, $maskconstorder, $maskorder, 'chaine', 0, '', $conf->entity); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; if (!$error) { diff --git a/htdocs/recruitment/class/recruitmentcandidature.class.php b/htdocs/recruitment/class/recruitmentcandidature.class.php index 3049f83a053..9e99cbc29fb 100644 --- a/htdocs/recruitment/class/recruitmentcandidature.class.php +++ b/htdocs/recruitment/class/recruitmentcandidature.class.php @@ -115,7 +115,7 @@ class RecruitmentCandidature extends CommonObject 'fk_user_modif' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>'1', 'position'=>511, 'notnull'=>-1, 'visible'=>-2,), 'lastname' => array('type'=>'varchar(128)', 'label'=>'Lastname', 'enabled'=>'1', 'position'=>20, 'notnull'=>0, 'visible'=>1,), 'firstname' => array('type'=>'varchar(128)', 'label'=>'Firstname', 'enabled'=>'1', 'position'=>21, 'notnull'=>0, 'visible'=>1,), - 'email' => array('type'=>'varchar(255)', 'label'=>'EMail', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1,), + 'email' => array('type'=>'varchar(255)', 'label'=>'EMail', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'picto'=>'email'), 'phone' => array('type'=>'varchar(64)', 'label'=>'Phone', 'enabled'=>'1', 'position'=>31, 'notnull'=>0, 'visible'=>1,), 'date_birth' => array('type'=>'date', 'label'=>'DateOfBirth', 'enabled'=>'1', 'position'=>70, 'visible'=>-1,), 'email_msgid' => array('type'=>'varchar(255)', 'label'=>'EmailMsgID', 'visible'=>-2, 'enabled'=>1, 'position'=>540, 'notnull'=>-1, 'help'=>'EmailMsgIDDesc'), diff --git a/htdocs/recruitment/class/recruitmentjobposition.class.php b/htdocs/recruitment/class/recruitmentjobposition.class.php index c202a523e58..6861717d825 100644 --- a/htdocs/recruitment/class/recruitmentjobposition.class.php +++ b/htdocs/recruitment/class/recruitmentjobposition.class.php @@ -103,13 +103,13 @@ class RecruitmentJobPosition extends CommonObject 'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'position'=>5, 'notnull'=>1, 'default'=>'1', 'index'=>1), 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'visible'=>4, 'noteditable'=>'1', 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'showoncombobox'=>'1', 'comment'=>"Reference of object"), 'label' => array('type'=>'varchar(255)', 'label'=>'JobLabel', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth500', 'csslist'=>'tdoverflowmax300', 'showoncombobox'=>'1', 'autofocusoncreate'=>1), - 'qty' => array('type'=>'integer', 'label'=>'NbOfEmployeesExpected', 'enabled'=>'1', 'position'=>45, 'notnull'=>1, 'visible'=>1, 'default'=>'1', 'isameasure'=>'1', 'css'=>'maxwidth75imp',), - 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'enabled'=>'1', 'position'=>52, 'notnull'=>-1, 'visible'=>-1, 'index'=>1,), + 'qty' => array('type'=>'integer', 'label'=>'NbOfEmployeesExpected', 'enabled'=>'1', 'position'=>45, 'notnull'=>1, 'visible'=>1, 'default'=>'1', 'isameasure'=>'1', 'css'=>'maxwidth75imp'), + 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'enabled'=>'1', 'position'=>52, 'notnull'=>-1, 'visible'=>-1, 'index'=>1, 'css'=>'maxwidth500', 'picto'=>'project'), 'fk_user_recruiter' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'ResponsibleOfRecruitement', 'enabled'=>'1', 'position'=>54, 'notnull'=>1, 'visible'=>1, 'foreignkey'=>'user.rowid', 'csslist'=>'tdoverflowmax150'), - 'email_recruiter' => array('type'=>'varchar(255)', 'label'=>'EmailRecruiter', 'enabled'=>'1', 'position'=>54, 'notnull'=>0, 'visible'=>-1, 'help'=>'ToUseAGenericEmail'), + 'email_recruiter' => array('type'=>'varchar(255)', 'label'=>'EmailRecruiter', 'enabled'=>'1', 'position'=>54, 'notnull'=>0, 'visible'=>-1, 'help'=>'ToUseAGenericEmail', 'picto'=>'email'), 'fk_user_supervisor' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'FutureManager', 'enabled'=>'1', 'position'=>55, 'notnull'=>0, 'visible'=>-1, 'foreignkey'=>'user.rowid',), 'fk_establishment' => array('type'=>'integer:Establishment:hrm/class/establishment.class.php', 'label'=>'Establishment', 'enabled'=>'$conf->hrm->enabled', 'position'=>56, 'notnull'=>0, 'visible'=>-1, 'foreignkey'=>'establishment.rowid',), - 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'WorkPlace', 'enabled'=>'1', 'position'=>57, 'notnull'=>-1, 'visible'=>-1, 'index'=>1, 'help'=>"IfJobIsLocatedAtAPartner",), + 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'WorkPlace', 'enabled'=>'1', 'position'=>57, 'notnull'=>-1, 'visible'=>-1, 'css'=>'maxwidth500', 'index'=>1, 'help'=>"IfJobIsLocatedAtAPartner", 'picto'=>'company'), 'date_planned' => array('type'=>'date', 'label'=>'DateExpected', 'enabled'=>'1', 'position'=>60, 'notnull'=>0, 'visible'=>1,), 'remuneration_suggested' => array('type'=>'varchar(255)', 'label'=>'Remuneration', 'enabled'=>'1', 'position'=>62, 'notnull'=>0, 'visible'=>1,), 'description' => array('type'=>'html', 'label'=>'Description', 'enabled'=>'1', 'position'=>65, 'notnull'=>0, 'visible'=>3,), diff --git a/htdocs/societe/admin/societe.php b/htdocs/societe/admin/societe.php index 49b58d61d08..aa738f0845b 100644 --- a/htdocs/societe/admin/societe.php +++ b/htdocs/societe/admin/societe.php @@ -75,7 +75,7 @@ if ($action == 'updateoptions') { $companysearch = GETPOST('activate_COMPANY_USE_SEARCH_TO_SELECT', 'alpha'); $res = dolibarr_set_const($db, "COMPANY_USE_SEARCH_TO_SELECT", $companysearch, 'chaine', 0, '', $conf->entity); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); @@ -88,7 +88,7 @@ if ($action == 'updateoptions') { $contactsearch = GETPOST('activate_CONTACT_USE_SEARCH_TO_SELECT', 'alpha'); $res = dolibarr_set_const($db, "CONTACT_USE_SEARCH_TO_SELECT", $contactsearch, 'chaine', 0, '', $conf->entity); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); @@ -101,7 +101,7 @@ if ($action == 'updateoptions') { $customertypedefault = GETPOST('defaultcustomertype', 'int'); $res = dolibarr_set_const($db, "THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT", $customertypedefault, 'chaine', 0, '', $conf->entity); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); @@ -176,7 +176,7 @@ if ($action == 'setdoc') if ($action == "setaddrefinlist") { $setaddrefinlist = GETPOST('value', 'int'); $res = dolibarr_set_const($db, "SOCIETE_ADD_REF_IN_LIST", $setaddrefinlist, 'yesno', 0, '', $conf->entity); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); @@ -189,7 +189,7 @@ if ($action == "setaddrefinlist") { if ($action == "setaddadressinlist") { $val = GETPOST('value', 'int'); $res = dolibarr_set_const($db, "COMPANY_SHOW_ADDRESS_SELECTLIST", $val, 'yesno', 0, '', $conf->entity); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); @@ -202,7 +202,7 @@ if ($action == "setaddadressinlist") { if ($action == "setaddemailphonetownincontactlist") { $val = GETPOST('value', 'int'); $res = dolibarr_set_const($db, "CONTACT_SHOW_EMAIL_PHONE_TOWN_SELECTLIST", $val, 'yesno', 0, '', $conf->entity); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { @@ -214,7 +214,7 @@ if ($action == "setaddemailphonetownincontactlist") { if ($action == "setaskforshippingmet") { $setaskforshippingmet = GETPOST('value', 'int'); $res = dolibarr_set_const($db, "SOCIETE_ASK_FOR_SHIPPING_METHOD", $setaskforshippingmet, 'yesno', 0, '', $conf->entity); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); @@ -227,7 +227,7 @@ if ($action == "setaskforshippingmet") { if ($action == "setdisableprospectcustomer") { $setdisableprospectcustomer = GETPOST('value', 'int'); $res = dolibarr_set_const($db, "SOCIETE_DISABLE_PROSPECTSCUSTOMERS", $setdisableprospectcustomer, 'yesno', 0, '', $conf->entity); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); @@ -297,7 +297,7 @@ if ($action == 'sethideinactivethirdparty') if ($action == 'setonsearchandlistgooncustomerorsuppliercard') { $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); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 401c5572597..fa2762c9269 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1235,9 +1235,8 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) print ''; // Name, firstname - print ''; @@ -2048,9 +2047,9 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) // EMail / Web print ''; - print ''; + print ''; print ''; - print ''; + print ''; if (!empty($conf->socialnetworks->enabled)) { foreach ($socialnetworks as $key => $value) { @@ -2415,7 +2414,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) // Prefix if (!empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field { - print ''; + print ''; print ''; } @@ -2423,8 +2422,11 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) if ($object->client) { print ''; + print ''; $tmpcheck = $object->check_codeclient(); if ($tmpcheck != 0 && $tmpcheck != -5) { print ' ('.$langs->trans("WrongCustomerCode").')'; @@ -2438,7 +2440,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''; print ''; } @@ -2467,7 +2469,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) print ''; print ''; } -// Town -if (!empty($arrayfields['s.town']['checked'])) -{ - print ''; -} // Zip if (!empty($arrayfields['s.zip']['checked'])) { @@ -793,6 +797,13 @@ if (!empty($arrayfields['s.zip']['checked'])) print ''; print ''; } +// Town +if (!empty($arrayfields['s.town']['checked'])) +{ + print ''; +} // State if (!empty($arrayfields['state.nom']['checked'])) { @@ -821,6 +832,13 @@ if (!empty($arrayfields['typent.code']['checked'])) print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 1, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT), 'maxwidth75', 1); print ''; } +// Multiprice level +if (!empty($arrayfields['s.price_level']['checked'])) +{ + print ''; +} // Staff if (!empty($arrayfields['staff.code']['checked'])) { @@ -989,16 +1007,17 @@ if (!empty($arrayfields['s.code_fournisseur']['checked'])) print_liste_fi if (!empty($arrayfields['s.code_compta']['checked'])) print_liste_field_titre($arrayfields['s.code_compta']['label'], $_SERVER["PHP_SELF"], "s.code_compta", "", $param, '', $sortfield, $sortorder); if (!empty($arrayfields['s.code_compta_fournisseur']['checked'])) print_liste_field_titre($arrayfields['s.code_compta_fournisseur']['label'], $_SERVER["PHP_SELF"], "s.code_compta_fournisseur", "", $param, '', $sortfield, $sortorder); if (!empty($arrayfields['s.address']['checked'])) print_liste_field_titre($arrayfields['s.address']['label'], $_SERVER['PHP_SELF'], 's.address', '', $param, '', $sortfield, $sortorder); -if (!empty($arrayfields['s.town']['checked'])) print_liste_field_titre($arrayfields['s.town']['label'], $_SERVER["PHP_SELF"], "s.town", "", $param, '', $sortfield, $sortorder); if (!empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($arrayfields['s.zip']['label'], $_SERVER["PHP_SELF"], "s.zip", "", $param, '', $sortfield, $sortorder); +if (!empty($arrayfields['s.town']['checked'])) print_liste_field_titre($arrayfields['s.town']['label'], $_SERVER["PHP_SELF"], "s.town", "", $param, '', $sortfield, $sortorder); if (!empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.nom']['label'], $_SERVER["PHP_SELF"], "state.nom", "", $param, '', $sortfield, $sortorder); if (!empty($arrayfields['region.nom']['checked'])) print_liste_field_titre($arrayfields['region.nom']['label'], $_SERVER["PHP_SELF"], "region.nom", "", $param, '', $sortfield, $sortorder); if (!empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, '', $sortfield, $sortorder, 'center '); if (!empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, '', $sortfield, $sortorder, 'center '); if (!empty($arrayfields['staff.code']['checked'])) print_liste_field_titre($arrayfields['staff.code']['label'], $_SERVER["PHP_SELF"], "staff.code", "", $param, '', $sortfield, $sortorder, 'center '); +if (!empty($arrayfields['s.price_level']['checked'])) print_liste_field_titre($arrayfields['s.price_level']['label'], $_SERVER["PHP_SELF"], "s.price_level", "", $param, '', $sortfield, $sortorder); if (!empty($arrayfields['s.email']['checked'])) print_liste_field_titre($arrayfields['s.email']['label'], $_SERVER["PHP_SELF"], "s.email", "", $param, '', $sortfield, $sortorder); if (!empty($arrayfields['s.phone']['checked'])) print_liste_field_titre($arrayfields['s.phone']['label'], $_SERVER["PHP_SELF"], "s.phone", "", $param, '', $sortfield, $sortorder); -if (!empty($arrayfields['s.fax']['checked'])) print_liste_field_titre($arrayfields['s.fax']['label'], $_SERVER["PHP_SELF"], "s.fax", "", $param, '', $sortfield, $sortorder); +if (!empty($arrayfields['s.fax']['checked'])) print_liste_field_titre($arrayfields['s.fax']['label'], $_SERVER["PHP_SELF"], "s.fax", "", $param, '', $sortfield, $sortorder); if (!empty($arrayfields['s.url']['checked'])) print_liste_field_titre($arrayfields['s.url']['label'], $_SERVER["PHP_SELF"], "s.url", "", $param, '', $sortfield, $sortorder); if (!empty($arrayfields['s.siren']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId1Short"), $textprofid[1], 1, 0), $_SERVER["PHP_SELF"], "s.siren", "", $param, '', $sortfield, $sortorder, 'nowrap '); if (!empty($arrayfields['s.siret']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId2Short"), $textprofid[2], 1, 0), $_SERVER["PHP_SELF"], "s.siret", "", $param, '', $sortfield, $sortorder, 'nowrap '); @@ -1011,6 +1030,7 @@ if (!empty($arrayfields['customerorsupplier']['checked'])) print_liste_fi if (!empty($arrayfields['s.fk_prospectlevel']['checked'])) print_liste_field_titre($arrayfields['s.fk_prospectlevel']['label'], $_SERVER["PHP_SELF"], "s.fk_prospectlevel", "", $param, '', $sortfield, $sortorder, 'center '); if (!empty($arrayfields['s.fk_stcomm']['checked'])) print_liste_field_titre($arrayfields['s.fk_stcomm']['label'], $_SERVER["PHP_SELF"], "s.fk_stcomm", "", $param, '', $sortfield, $sortorder, 'center '); if (!empty($arrayfields['s2.nom']['checked'])) print_liste_field_titre($arrayfields['s2.nom']['label'], $_SERVER["PHP_SELF"], "s2.nom", "", $param, '', $sortfield, $sortorder, 'center '); + // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields @@ -1123,18 +1143,18 @@ while ($i < min($num, $limit)) print ''; if (!$i) $totalarray['nbfield']++; } - // Town - if (!empty($arrayfields['s.town']['checked'])) - { - print "\n"; - if (!$i) $totalarray['nbfield']++; - } // Zip if (!empty($arrayfields['s.zip']['checked'])) { print "\n"; if (!$i) $totalarray['nbfield']++; } + // Town + if (!empty($arrayfields['s.town']['checked'])) + { + print "\n"; + if (!$i) $totalarray['nbfield']++; + } // State if (!empty($arrayfields['state.nom']['checked'])) { @@ -1165,6 +1185,12 @@ while ($i < min($num, $limit)) print ''; if (!$i) $totalarray['nbfield']++; } + // Multiprice level + if (!empty($arrayfields['s.price_level']['checked'])) + { + print '\n"; + if (!$i) $totalarray['nbfield']++; + } // Staff if (!empty($arrayfields['staff.code']['checked'])) { @@ -1285,7 +1311,7 @@ while ($i < min($num, $limit)) // Parent company if (!empty($arrayfields['s2.nom']['checked'])) { - print ''; } +// Activate Bancontact +if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // TODO Not used by current code +{ + print ''; +} + // Activate iDEAL if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // TODO Not used by current code { @@ -402,6 +417,36 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // TODO Not used by current code print ''; } +// Activate Giropay +if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // TODO Not used by current code +{ + print ''; +} + +// Activate Sofort +if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // TODO Not used by current code +{ + print ''; +} + // Warehouse for automatic decrement //if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // warehouse to reduce stock for online payment //{ @@ -493,7 +538,7 @@ $token = ''; include DOL_DOCUMENT_ROOT.'/core/tpl/onlinepaymentlinks.tpl.php'; -print info_admin($langs->trans("ExampleOfTestCreditCard", '4242424242424242 (no 3DSecure) or 4000000000003063 (3DSecure required) or 4000002760003184 (3DSecure2 required on all transaction) or 4000003800000446 (3DSecure2 required the off-seesion allowed)', '4000000000000101', '4000000000000069', '4000000000000341')); +print info_admin($langs->trans("ExampleOfTestCreditCard", '4242424242424242 (no 3DSecure) or 4000000000003063 (3DSecure required) or 4000002760003184 (3DSecure2 required on all transaction) or 4000003800000446 (3DSecure2 required, the off-session allowed)', '4000000000000101', '4000000000000069', '4000000000000341')); if (!empty($conf->use_javascript_ajax)) { diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index db225196ea7..259e1cea935 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2018-2021 Thibault FOUCART * * 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 @@ -317,15 +317,15 @@ class Stripe extends CommonObject * @param int $mode automatic=automatic confirmation/payment when conditions are ok, manual=need to call confirm() on intent * @param boolean $confirmnow false=default, true=try to confirm immediatly after create (if conditions are ok) * @param string $payment_method 'pm_....' (if known) - * @param string $off_session If we use an already known payment method to pay off line. + * @param string $off_session If we use an already known payment method to pay when customer is not available during the checkout flow. * @param string $noidempotency_key Do not use the idempotency_key when creating the PaymentIntent * @return \Stripe\PaymentIntent|null Stripe PaymentIntent or null if not found and failed to create */ - public function getPaymentIntent($amount, $currency_code, $tag, $description = '', $object = null, $customer = null, $key = null, $status = 0, $usethirdpartyemailforreceiptemail = 0, $mode = 'automatic', $confirmnow = false, $payment_method = null, $off_session = 0, $noidempotency_key = 0) + public function getPaymentIntent($amount, $currency_code, $tag, $description = '', $object = null, $customer = null, $key = null, $status = 0, $usethirdpartyemailforreceiptemail = 0, $mode = 'automatic', $confirmnow = false, $payment_method = null, $off_session = 0, $noidempotency_key = 1) { global $conf, $user; - dol_syslog("getPaymentIntent", LOG_INFO, 1); + dol_syslog(get_class($this)."::getPaymentIntent", LOG_INFO, 1); $error = 0; @@ -397,6 +397,7 @@ class Stripe extends CommonObject if (empty($paymentintent)) { + // Try to create intent. See https://stripe.com/docs/api/payment_intents/create $ipaddress = getUserRemoteIP(); $metadata = array('dol_version'=>DOL_VERSION, 'dol_entity'=>$conf->entity, 'ipaddress'=>$ipaddress); if (is_object($object)) @@ -409,7 +410,10 @@ class Stripe extends CommonObject // list of payment method types $paymentmethodtypes = array("card"); if (!empty($conf->global->STRIPE_SEPA_DIRECT_DEBIT)) $paymentmethodtypes[] = "sepa_debit"; //&& ($object->thirdparty->isInEEC()) - if (!empty($conf->global->STRIPE_IDEAL)) $paymentmethodtypes[] = "ideal"; //&& ($object->thirdparty->isInEEC()) + if (!empty($conf->global->STRIPE_BANCONTACT)) $paymentmethodtypes[] = "bancontact"; + if (!empty($conf->global->STRIPE_IDEAL)) $paymentmethodtypes[] = "ideal"; + if (!empty($conf->global->STRIPE_GIROPAY)) $paymentmethodtypes[] = "giropay"; + if (!empty($conf->global->STRIPE_SOFORT)) $paymentmethodtypes[] = "sofort"; $dataforintent = array( "confirm" => $confirmnow, // Do not confirm immediatly during creation of intent @@ -430,8 +434,13 @@ class Stripe extends CommonObject if ($off_session) { unset($dataforintent['setup_future_usage']); + // We can't use both "setup_future_usage" = "off_session" and "off_session" = true. + // Because $off_session parameter is dedicated to create paymentintent off_line (and not future payment), we need to use "off_session" = true. + //$dataforintent["setup_future_usage"] = "off_session"; $dataforintent["off_session"] = true; } + if (!empty($conf->global->STRIPE_GIROPAY)) unset($dataforintent['setup_future_usage']); + if (!is_null($payment_method)) { $dataforintent["payment_method"] = $payment_method; @@ -460,6 +469,9 @@ class Stripe extends CommonObject if (!empty($key)) { // If the Stripe connect account not set, we use common API usage $arrayofoptions["stripe_account"] = $key; } + + dol_syslog("dataforintent to create paymentintent = ".var_export($dataforintent, true)); + $paymentintent = \Stripe\PaymentIntent::create($dataforintent, $arrayofoptions); // Store the payment intent @@ -522,10 +534,9 @@ class Stripe extends CommonObject } } - dol_syslog("getPaymentIntent return error=".$error." this->error=".$this->error, LOG_INFO, -1); + dol_syslog(get_class($this)."::getPaymentIntent return error=".$error." this->error=".$this->error, LOG_INFO, -1); - if (!$error) - { + if (!$error) { return $paymentintent; } else { return null; @@ -578,7 +589,10 @@ class Stripe extends CommonObject // list of payment method types $paymentmethodtypes = array("card"); if (!empty($conf->global->STRIPE_SEPA_DIRECT_DEBIT)) $paymentmethodtypes[] = "sepa_debit"; //&& ($object->thirdparty->isInEEC()) - // iDEAL not supported with setupIntent + if (!empty($conf->global->STRIPE_BANCONTACT)) $paymentmethodtypes[] = "bancontact"; + if (!empty($conf->global->STRIPE_IDEAL)) $paymentmethodtypes[] = "ideal"; + // Giropay not possible for setup intent + if (!empty($conf->global->STRIPE_SOFORT)) $paymentmethodtypes[] = "sofort"; $dataforintent = array( "confirm" => $confirmnow, // Do not confirm immediatly during creation of intent @@ -922,7 +936,7 @@ class Stripe extends CommonObject dol_syslog("* createPaymentStripe get stripeacc", LOG_DEBUG); $stripeacc = $stripe->getStripeAccount($service); // Get Stripe OAuth connect account if it exists (no network access here) - dol_syslog("* createPaymentStripe Create payment on card ".$stripecard->id.", amounttopay=".$amounttopay.", amountstripe=".$amountstripe.", FULLTAG=".$FULLTAG, LOG_DEBUG); + dol_syslog("* createPaymentStripe Create payment for customer ".$customer->id." on source card ".$stripecard->id.", amounttopay=".$amounttopay.", amountstripe=".$amountstripe.", FULLTAG=".$FULLTAG, LOG_DEBUG); // Create payment intent and charge payment (confirmnow = true) $paymentintent = $stripe->getPaymentIntent($amounttopay, $currency, $FULLTAG, $description, $invoice, $customer->id, $stripeacc, $servicestatus, 0, 'automatic', true, $stripecard->id, 1); diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index d7ee97e1b9d..05bc3aec44d 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -263,8 +263,8 @@ if (empty($reshook)) $object->cond_reglement_id = GETPOST('cond_reglement_id'); $object->mode_reglement_id = GETPOST('mode_reglement_id'); $object->fk_account = GETPOST('fk_account', 'int'); - $object->remise_percent = GETPOST('remise_percent'); - $object->remise_absolue = GETPOST('remise_absolue'); + $object->remise_percent = price2num(GETPOST('remise_percent'), 2); + $object->remise_absolue = price2num(GETPOST('remise_absolue'), 'MU'); $object->socid = GETPOST('socid'); $object->fk_project = GETPOST('projectid', 'int'); $object->model_pdf = GETPOST('model'); @@ -556,7 +556,7 @@ if (empty($reshook)) } $qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS'); - $remise_percent = GETPOST('remise_percent'.$predef); + $remise_percent = price2num(GETPOST('remise_percent'.$predef), 2); $price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'CU'); // Extrafields @@ -929,10 +929,10 @@ if (empty($reshook)) $fk_unit = GETPOST('units'); $result = $object->updateline( - GETPOST('lineid'), + GETPOST('lineid', 'int'), $ht, - GETPOST('qty'), - GETPOST('remise_percent'), + price2num(GETPOST('qty'), 'MS'), + price2num(GETPOST('remise_percent'), 2), $vat_rate, $localtax1_rate, $localtax2_rate, @@ -940,7 +940,7 @@ if (empty($reshook)) $price_base_type, $info_bits, $special_code, - GETPOST('fk_parent_line'), + GETPOST('fk_parent_line', 'int'), 0, $fournprice, $buyingprice, @@ -1018,9 +1018,9 @@ if (empty($reshook)) elseif ($action == 'setconditions' && $usercancreate) { $result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int')); } elseif ($action == 'setremisepercent' && $usercancreate) { - $result = $object->set_remise_percent($user, GETPOST('remise_percent', 'alpha')); + $result = $object->set_remise_percent($user, price2num(GETPOST('remise_percent'), 2)); } elseif ($action == 'setremiseabsolue' && $usercancreate) { - $result = $object->set_remise_absolue($user, GETPOST('remise_absolue', 'alpha')); + $result = $object->set_remise_absolue($user, price2num(GETPOST('remise_absolue'), 'MU')); } // Payment mode diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index a939b95ffca..890dff34812 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -2183,16 +2183,16 @@ class SupplierProposal extends CommonObject { global $langs; $langs->load("supplier_proposal"); - $this->labelStatus[self::STATUS_DRAFT] = $langs->trans("SupplierProposalStatusDraft"); - $this->labelStatus[self::STATUS_VALIDATED] = $langs->trans("SupplierProposalStatusValidated"); - $this->labelStatus[self::STATUS_SIGNED] = $langs->trans("SupplierProposalStatusSigned"); - $this->labelStatus[self::STATUS_NOTSIGNED] = $langs->trans("SupplierProposalStatusNotSigned"); - $this->labelStatus[self::STATUS_CLOSE] = $langs->trans("SupplierProposalStatusClosed"); - $this->labelStatusShort[self::STATUS_DRAFT] = $langs->trans("SupplierProposalStatusDraftShort"); - $this->labelStatusShort[self::STATUS_VALIDATED] = $langs->trans("Opened"); - $this->labelStatusShort[self::STATUS_SIGNED] = $langs->trans("SupplierProposalStatusSignedShort"); - $this->labelStatusShort[self::STATUS_NOTSIGNED] = $langs->trans("SupplierProposalStatusNotSignedShort"); - $this->labelStatusShort[self::STATUS_CLOSE] = $langs->trans("SupplierProposalStatusClosedShort"); + $this->labelStatus[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv("SupplierProposalStatusDraft"); + $this->labelStatus[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv("SupplierProposalStatusValidated"); + $this->labelStatus[self::STATUS_SIGNED] = $langs->transnoentitiesnoconv("SupplierProposalStatusSigned"); + $this->labelStatus[self::STATUS_NOTSIGNED] = $langs->transnoentitiesnoconv("SupplierProposalStatusNotSigned"); + $this->labelStatus[self::STATUS_CLOSE] = $langs->transnoentitiesnoconv("SupplierProposalStatusClosed"); + $this->labelStatusShort[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv("SupplierProposalStatusDraftShort"); + $this->labelStatusShort[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv("Opened"); + $this->labelStatusShort[self::STATUS_SIGNED] = $langs->transnoentitiesnoconv("SupplierProposalStatusSignedShort"); + $this->labelStatusShort[self::STATUS_NOTSIGNED] = $langs->transnoentitiesnoconv("SupplierProposalStatusNotSignedShort"); + $this->labelStatusShort[self::STATUS_CLOSE] = $langs->transnoentitiesnoconv("SupplierProposalStatusClosedShort"); } $statusnew = ''; diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index d74f2fbdec3..421ac40b447 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -249,7 +249,7 @@ $help_url = 'EN:Ask_Price_Supplier|FR:Demande_de_prix_fournisseur'; //llxHeader('',$langs->trans('CommRequest'),$help_url); $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.town, s.zip, s.fk_pays, s.client, s.code_client,'; $sql .= " typent.code as typent_code,"; $sql .= " state.code_departement as state_code, state.nom as state_name,"; diff --git a/htdocs/takepos/admin/appearance.php b/htdocs/takepos/admin/appearance.php index baceed47f3e..eb956ea9f32 100644 --- a/htdocs/takepos/admin/appearance.php +++ b/htdocs/takepos/admin/appearance.php @@ -47,7 +47,7 @@ if (GETPOST('action', 'alpha') == 'set') dol_syslog("admin/cashdesk: level ".GETPOST('level', 'alpha')); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; if (!$error) { diff --git a/htdocs/takepos/admin/other.php b/htdocs/takepos/admin/other.php index 6874665ace7..e0beeedf502 100644 --- a/htdocs/takepos/admin/other.php +++ b/htdocs/takepos/admin/other.php @@ -86,7 +86,7 @@ if (GETPOST('action', 'alpha') == 'set') { dol_syslog("admin/cashdesk: level ".GETPOST('level', 'alpha')); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; if (!$error) { $db->commit(); diff --git a/htdocs/takepos/admin/receipt.php b/htdocs/takepos/admin/receipt.php index 30a9d45ad5a..01873d317c4 100644 --- a/htdocs/takepos/admin/receipt.php +++ b/htdocs/takepos/admin/receipt.php @@ -52,7 +52,7 @@ if (GETPOST('action', 'alpha') == 'set') dol_syslog("admin/cashdesk: level ".GETPOST('level', 'alpha')); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; if (!$error) { diff --git a/htdocs/takepos/admin/setup.php b/htdocs/takepos/admin/setup.php index 84efe32839e..f3c17f6ee23 100644 --- a/htdocs/takepos/admin/setup.php +++ b/htdocs/takepos/admin/setup.php @@ -85,7 +85,7 @@ if ($action == 'set') dol_syslog("admin/cashdesk: level ".GETPOST('level', 'alpha')); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; if (!$error) { @@ -97,7 +97,7 @@ if ($action == 'set') $maskconst = GETPOST('maskconst', 'alpha'); $maskvalue = GETPOST('maskvalue', 'alpha'); if ($maskconst) $res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity); - if (!$res > 0) { + if (!($res > 0)) { $error++; } } elseif ($action == 'setrefmod') { diff --git a/htdocs/takepos/admin/terminal.php b/htdocs/takepos/admin/terminal.php index d8ad03a057c..ed4ef31af36 100644 --- a/htdocs/takepos/admin/terminal.php +++ b/htdocs/takepos/admin/terminal.php @@ -101,7 +101,7 @@ if (GETPOST('action', 'alpha') == 'set') dol_syslog("admin/cashdesk: level ".GETPOST('level', 'alpha')); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; if (!$error) { diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 6fedcd0292a..01bf74972fe 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -776,11 +776,10 @@ $( document ).ready(function() { { print "ModalBox('ModalTerminal');"; } - if ($conf->global->TAKEPOS_CONTROL_CASH_OPENING) - { - $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."pos_cash_fence WHERE "; - $sql .= "date(date_creation) = CURDATE() "; - $sql .= ""; + if ($conf->global->TAKEPOS_CONTROL_CASH_OPENING) { + $sql = "SELECT rowid, status FROM ".MAIN_DB_PREFIX."pos_cash_fence WHERE"; + $sql .= " entity = ".$conf->entity." AND "; + $sql .= " date_creation > '".$db->idate(dol_get_first_hour(dol_now()))."'"; $resql = $db->query($sql); if ($resql) { $obj = $db->fetch_object($resql); @@ -1026,8 +1025,9 @@ if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter") { ); } -$sql = "SELECT rowid, status FROM ".MAIN_DB_PREFIX."pos_cash_fence WHERE "; -$sql .= "date(date_creation) = CURDATE() "; +$sql = "SELECT rowid, status, entity FROM ".MAIN_DB_PREFIX."pos_cash_fence WHERE"; +$sql .= " entity = ".$conf->entity." AND "; +$sql .= " date_creation > '".$db->idate(dol_get_first_hour(dol_now()))."'"; $resql = $db->query($sql); if ($resql) { diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index b28b237bd90..05b0f1308ec 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -125,6 +125,10 @@ th.liste_titre a div div:hover, th.liste_titre_sel a div div:hover { text-decora tr.liste_titre th.liste_titre_sel:not(.maxwidthsearch), tr.liste_titre td.liste_titre_sel:not(.maxwidthsearch), tr.liste_titre th.liste_titre:not(.maxwidthsearch), tr.liste_titre td.liste_titre:not(.maxwidthsearch) { opacity: 0.8; } /* th.liste_titre_sel a, th.liste_titre a, td.liste_titre_sel a, td.liste_titre a { color: #766; } */ + +input { + font-size: unset; +} input, input.flat, textarea, textarea.flat, form.flat select, select, select.flat, .dataTables_length label select { background-color: var(--inputbackgroundcolor); color: var(--colortext); @@ -174,9 +178,12 @@ input, input.flat, textarea, textarea.flat, form.flat select, select, select.fla input { line-height: 1.3em; - padding: 5px; + padding: 4px; padding-left: 5px; } +.liste_titre input { + padding: 5px; +} select { padding-top: 5px; padding-right: 4px; @@ -440,8 +447,12 @@ input:-webkit-autofill { background-image:none !important; -webkit-box-shadow: 0 0 0 50px #FDFFF0 inset; } -::-webkit-input-placeholder { color:#ccc; } -input:-moz-placeholder { color:#ccc; } + +/* CSS for placeholder */ +.placeholder { color: #ccc; } +::-webkit-input-placeholder { color: #ccc; } +input:-moz-placeholder { color: #ccc; } + input[name=price], input[name=weight], input[name=volume], input[name=surface], input[name=sizeheight], input[name=net_measure], select[name=incoterm_id] { margin-right: 6px; } fieldset { border: 1px solid #AAAAAA !important; } .legendforfieldsetstep { padding-bottom: 10px; } @@ -670,6 +681,15 @@ textarea.centpercent { .nounderline { text-decoration: none; } +.nopadding { + padding: 0; +} +.nopaddingleft { + padding-left: 0; +} +.nopaddingright { + padding-right: 0; +} .paddingleft { padding-: 4px; } @@ -1304,11 +1324,11 @@ table[summary="list_of_modules"] .fa-cog { .minwidth500imp { min-width: 250px !important; } } -select.widthcentpercentminusx, span.widthcentpercentminusx, input.widthcentpercentminusx { +select.widthcentpercentminusx, span.widthcentpercentminusx:not(.select2-selection), input.widthcentpercentminusx { width: calc(100% - 52px) !important; display: inline-block; } -select.widthcentpercentminusxx, span.widthcentpercentminusxx, input.widthcentpercentminusxx { +select.widthcentpercentminusxx, span.widthcentpercentminusxx:not(.select2-selection), input.widthcentpercentminusxx { width: calc(100% - 70px) !important; display: inline-block; } @@ -2568,6 +2588,9 @@ img.userphotosmall { /* size for user photo in lists */ img.userphoto[alt="Gravatar avatar"], img.photouserphoto.dropdown-user-image[alt="Gravatar avatar"] { background: #fff; } +form[name="addtime"] img.userphoto { + border: 1px solid #444; +} .span-icon-user { background-image: url(); background-repeat: no-repeat; @@ -3043,6 +3066,9 @@ tr.nocellnopadd td.nobordernopadding, tr.nocellnopadd td.nocellnopadd .smallpaddingimp { padding: 4px !important; } +input.button.smallpaddingimp { + font-size: 0.8em; +} .nopaddingleft { padding-: 0px; } @@ -4127,7 +4153,7 @@ div.boximport { .fieldrequired { font-weight: bold; color: var(--fieldrequiredcolor) !important; } -td.widthpictotitle { width: 26px; text-align: ; } +td.widthpictotitle { width: 38px; text-align: ; } span.widthpictotitle { font-size: 1.7em; } table.titlemodulehelp tr td img.widthpictotitle { width: 80px; } @@ -5639,6 +5665,8 @@ a span.select2-chosen } span#select2-boxbookmark-container, span#select2-boxcombo-container { text-align: ; +} +span#select2-boxbookmark-container { opacity: 0.4; } .select2-container .select2-selection--single .select2-selection__rendered { @@ -6550,6 +6578,15 @@ div.phpdebugbar-widgets-templates a.phpdebugbar-widgets-editor-link:before } +/* ============================================================================== */ +/* For copypaste feature */ +/* ============================================================================== */ + +.clipboardCPShowOnHover .clipboardCPButton { + display: none; +} + + /* ============================================================================== */ /* CSS style used for small screen */ /* ============================================================================== */ diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 850d5561f66..ae60254ea13 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -297,6 +297,9 @@ a:link, a:visited, a:hover, a:active { font-family: ; fo a:hover { text-decoration: underline; color: rgb(); } a.commonlink { color: rgb() !important; text-decoration: none; } +input { + font-size: unset; +} input, input.flat, textarea, textarea.flat, form.flat select, select, select.flat, .dataTables_length label select { background-color: #FDFDFD; } @@ -568,11 +571,15 @@ input:-webkit-autofill { background-image:none !important; -webkit-box-shadow: 0 0 0 50px #FBFFEA inset; } + +/* CSS for placeholder */ +.placeholder { color: #ccc; } ::-webkit-input-placeholder { color:#ccc; } :-moz-placeholder { color:#bbb; } /* firefox 18- */ ::-moz-placeholder { color:#bbb; } /* firefox 19+ */ :-ms-input-placeholder { color:#ccc; } /* ie */ input:-moz-placeholder { color:#ccc; } + input[name=price], input[name=weight], input[name=volume], input[name=surface], input[name=sizeheight], input[name=net_measure], select[name=incoterm_id] { margin-right: 6px; } fieldset { border: 1px solid #AAAAAA !important; } .legendforfieldsetstep { padding-bottom: 10px; } @@ -770,6 +777,15 @@ textarea.centpercent { .nounderline { text-decoration: none; } +.nopadding { + padding: 0; +} +.nopaddingleft { + padding-left: 0; +} +.nopaddingright { + padding-right: 0; +} .paddingleft { padding-: 4px; } @@ -2559,6 +2575,9 @@ img.userphotosmall { /* size for user photo in lists */ img.userphoto[alt="Gravatar avatar"] { background: #fff; } +form[name="addtime"] img.userphoto { + border: 1px solid #444; +} .span-icon-user { background-image: url(); background-repeat: no-repeat; diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 84bec78bf30..6d14d29202f 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -586,16 +586,16 @@ if (empty($reshook)) { if (!$error) { $result = $object->insertExtraFields(empty($triggermodname) ? '' : $triggermodname, $user); - if ($result > 0) { - setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); - $action = 'view'; - } else { - $error++; - setEventMessages($object->error, $object->errors, 'errors'); - } + if ($result < 0) { $error++; } } - if ($error) $action = 'edit_extras'; + if ($error) { + setEventMessages($object->error, $object->errors, 'errors'); + $action = 'edit_extras'; + } else { + setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); + $action = 'view'; + } } if ($action == "change_property" && GETPOST('btn_update_ticket_prop', 'alpha') && $user->rights->ticket->write) { @@ -637,6 +637,7 @@ if (empty($reshook)) { if (GETPOSTISSET('actionbis') && $action == 'presend') $action = 'presend_addmessage'; } + /* * View */ @@ -937,14 +938,14 @@ elseif (empty($action) || $action == 'view' || $action == 'addlink' || $action = // Creation date print ''; // Read date print ''; diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 03e87067d10..306f861097b 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -223,9 +223,10 @@ class Ticket extends CommonObject /** - * 'type' if the field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password') + * 'type' field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'sellist:TableName:LabelFieldName[:KeyFieldName[:KeyFieldParent[:Filter]]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'text:none', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password') * Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)" * 'label' the translation key. + * 'picto' is code of a picto to show before value in forms * 'enabled' is a condition when the field must be managed (Example: 1 or '$conf->global->MY_SETUP_PARAM) * 'position' is the sort order of field. * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0). @@ -236,8 +237,8 @@ class Ticket extends CommonObject * 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...). * 'searchall' is 1 if we want to search in this field when making a search from the quick search button. * 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8). - * 'css' and 'cssview' is the CSS style to use on field. 'css' is used in creation and update. 'cssview' is used in view mode. For example: 'maxwidth200', 'wordbreak' - * 'help' is a string visible as a tooltip on field + * 'css' and 'cssview' and 'csslist' is the CSS style to use on field. 'css' is used in creation and update. 'cssview' is used in view mode. 'csslist' is used for columns in lists. For example: 'maxwidth200', 'wordbreak', 'tdoverflowmax200' + * 'help' is a 'TranslationString' to use to show a tooltip on field. You can also use 'TranslationString:keyfortooltiponlick' for a tooltip on click. * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record * 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code. * 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") @@ -255,16 +256,16 @@ class Ticket extends CommonObject 'track_id' => array('type'=>'varchar(255)', 'label'=>'TicketTrackId', 'visible'=>-2, 'enabled'=>1, 'position'=>11, 'notnull'=>-1, 'searchall'=>1, 'help'=>"Help text"), 'fk_user_create' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Author', 'visible'=>1, 'enabled'=>1, 'position'=>15, 'notnull'=>1, 'css'=>'tdoverflowmax150 maxwidth150onsmartphone'), 'origin_email' => array('type'=>'mail', 'label'=>'OriginEmail', 'visible'=>-2, 'enabled'=>1, 'position'=>16, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object", 'css'=>'tdoverflowmax150'), - 'subject' => array('type'=>'varchar(255)', 'label'=>'Subject', 'visible'=>1, 'enabled'=>1, 'position'=>18, 'notnull'=>-1, 'searchall'=>1, 'help'=>"", 'css'=>'maxwidth200', 'autofocusoncreate'=>1), - 'type_code' => array('type'=>'varchar(32)', 'label'=>'Type', 'visible'=>1, 'enabled'=>1, 'position'=>20, 'notnull'=>-1, 'help'=>"", 'css'=>'maxwidth150 tdoverflowmax50'), + 'subject' => array('type'=>'varchar(255)', 'label'=>'Subject', 'visible'=>1, 'enabled'=>1, 'position'=>18, 'notnull'=>-1, 'searchall'=>1, 'help'=>"", 'css'=>'maxwidth200 tdoverflowmax200', 'autofocusoncreate'=>1), + 'type_code' => array('type'=>'varchar(32)', 'label'=>'Type', 'visible'=>1, 'enabled'=>1, 'position'=>20, 'notnull'=>-1, 'help'=>"", 'css'=>'maxwidth125 tdoverflowmax50'), 'category_code' => array('type'=>'varchar(32)', 'label'=>'TicketCategory', 'visible'=>-1, 'enabled'=>1, 'position'=>21, 'notnull'=>-1, 'help'=>"", 'css'=>'maxwidth100'), 'severity_code' => array('type'=>'varchar(32)', 'label'=>'Severity', 'visible'=>1, 'enabled'=>1, 'position'=>22, 'notnull'=>-1, 'help'=>"", 'css'=>'maxwidth100'), - 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'visible'=>1, 'enabled'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'searchall'=>1, 'help'=>"LinkToThirparty", 'css'=>'tdoverflowmax150 maxwidth150onsmartphone'), + 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'visible'=>1, 'enabled'=>'$conf->societe->enabled', 'position'=>50, 'notnull'=>-1, 'index'=>1, 'searchall'=>1, 'help'=>"LinkToThirparty", 'css'=>'tdoverflowmax150 maxwidth150onsmartphone'), 'notify_tiers_at_create' => array('type'=>'integer', 'label'=>'NotifyThirdparty', 'visible'=>-1, 'enabled'=>0, 'position'=>51, 'notnull'=>1, 'index'=>1), 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php', 'label'=>'Project', 'visible'=>-1, 'enabled'=>1, 'position'=>52, 'notnull'=>-1, 'index'=>1, 'help'=>"LinkToProject"), 'timing' => array('type'=>'varchar(20)', 'label'=>'Timing', 'visible'=>-1, 'enabled'=>1, 'position'=>42, 'notnull'=>-1, 'help'=>""), 'datec' => array('type'=>'datetime', 'label'=>'DateCreation', 'visible'=>1, 'enabled'=>1, 'position'=>500, 'notnull'=>1), - 'date_read' => array('type'=>'datetime', 'label'=>'TicketReadOn', 'visible'=>1, 'enabled'=>1, 'position'=>501, 'notnull'=>1), + 'date_read' => array('type'=>'datetime', 'label'=>'TicketReadOn', 'visible'=>-1, 'enabled'=>1, 'position'=>501, 'notnull'=>1), 'fk_user_assign' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'AssignedTo', 'visible'=>1, 'enabled'=>1, 'position'=>505, 'notnull'=>1, 'css'=>'tdoverflowmax150'), 'date_close' => array('type'=>'datetime', 'label'=>'TicketCloseOn', 'visible'=>-1, 'enabled'=>1, 'position'=>510, 'notnull'=>1), 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'visible'=>-1, 'enabled'=>1, 'position'=>520, 'notnull'=>1), diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index 8db50076bbf..0c6db4a4a2d 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -428,7 +428,7 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $ // Output page // -------------------------------------------------------------------- -llxHeader('', $title, $help_url); +llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'classforhorizontalscrolloftabs'); if ($socid && !$projectid && !$project_ref && $user->rights->societe->lire) { @@ -811,6 +811,12 @@ while ($i < min($num, $limit)) if ($cssforfield || $val['css']) print '"'; print '>'; if ($key == 'fk_statut') print $object->getLibStatut(5); + elseif ($key == 'subject') { + $s = $obj->subject; + print ''; + print $s; + print ''; + } elseif ($key == 'type_code') { $s = $langs->getLabelFromKey($db, 'TicketTypeShort'.$object->type_code, 'c_ticket_type', 'code', 'label', $object->type_code); print ''; diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 1aac46933f2..8f8f8c67ca8 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -2398,53 +2398,54 @@ class User extends CommonObject $label .= '
'; $label .= img_picto('', $this->picto).' '.$langs->trans("User").''; $label .= ' '.$this->getLibStatut(4); - $label .= '
'.$langs->trans('Name').': '.$this->getFullName($langs, ''); + $label .= '
'.$langs->trans('Name').': '.dol_string_nohtmltag($this->getFullName($langs, '')); if (!empty($this->login)) { - $label .= '
'.$langs->trans('Login').': '.$this->login; + $label .= '
'.$langs->trans('Login').': '.dol_string_nohtmltag($this->login); } if (!empty($this->job)) { - $label .= '
'.$langs->trans("Job").': '.$this->job; + $label .= '
'.$langs->trans("Job").': '.dol_string_nohtmltag($this->job); } - $label .= '
'.$langs->trans("Email").': '.$this->email; + $label .= '
'.$langs->trans("Email").': '.dol_string_nohtmltag($this->email); if (!empty($this->phone)) { - $label .= '
'.$langs->trans("Phone").': '.$this->phone; + $label .= '
'.$langs->trans("Phone").': '.dol_string_nohtmltag($this->phone); } if (!empty($this->admin)) { $label .= '
'.$langs->trans("Administrator").': '.yn($this->admin); } + $company = ''; if (!empty($this->socid)) { // Add thirdparty for external users $thirdpartystatic = new Societe($db); $thirdpartystatic->fetch($this->socid); if (empty($hidethirdpartylogo)) { $companylink = ' '.$thirdpartystatic->getNomUrl(2, (($option == 'nolink') ? 'nolink' : '')); // picto only of company } - $company = ' ('.$langs->trans("Company").': '.$thirdpartystatic->name.')'; + $company = ' ('.$langs->trans("Company").': '.dol_string_nohtmltag($thirdpartystatic->name).')'; } $type = ($this->socid ? $langs->trans("External").$company : $langs->trans("Internal")); - $label .= '
'.$langs->trans("Type").': '.$type; + $label .= '
'.$langs->trans("Type").': '.dol_string_nohtmltag($type); $label .= '
'; if ($infologin > 0) { $label .= '
'; $label .= '
'.$langs->trans("Session").''; - $label .= '
'.$langs->trans("IPAddress").': '.$_SERVER["REMOTE_ADDR"]; + $label .= '
'.$langs->trans("IPAddress").': '.dol_string_nohtmltag(getUserRemoteIP()); if (!empty($conf->global->MAIN_MODULE_MULTICOMPANY)) { - $label .= '
'.$langs->trans("ConnectedOnMultiCompany").': '.$conf->entity.' (user entity '.$this->entity.')'; + $label .= '
'.$langs->trans("ConnectedOnMultiCompany").': '.$conf->entity.' (User entity '.$this->entity.')'; } - $label .= '
'.$langs->trans("AuthenticationMode").': '.$_SESSION["dol_authmode"].(empty($dolibarr_main_demo) ? '' : ' (demo)'); + $label .= '
'.$langs->trans("AuthenticationMode").': '.dol_string_nohtmltag($_SESSION["dol_authmode"].(empty($dolibarr_main_demo) ? '' : ' (demo)')); $label .= '
'.$langs->trans("ConnectedSince").': '.dol_print_date($this->datelastlogin, "dayhour", 'tzuser'); $label .= '
'.$langs->trans("PreviousConnexion").': '.dol_print_date($this->datepreviouslogin, "dayhour", 'tzuser'); - $label .= '
'.$langs->trans("CurrentTheme").': '.$conf->theme; - $label .= '
'.$langs->trans("CurrentMenuManager").': '.$menumanager->name; + $label .= '
'.$langs->trans("CurrentTheme").': '.dol_string_nohtmltag($conf->theme); + $label .= '
'.$langs->trans("CurrentMenuManager").': '.dol_string_nohtmltag($menumanager->name); $s = picto_from_langcode($langs->getDefaultLang()); - $label .= '
'.$langs->trans("CurrentUserLanguage").': '.($s ? $s.' ' : '').$langs->getDefaultLang(); - $label .= '
'.$langs->trans("Browser").': '.$conf->browser->name.($conf->browser->version ? ' '.$conf->browser->version : '').' ('.$_SERVER['HTTP_USER_AGENT'].')'; - $label .= '
'.$langs->trans("Layout").': '.$conf->browser->layout; - $label .= '
'.$langs->trans("Screen").': '.$_SESSION['dol_screenwidth'].' x '.$_SESSION['dol_screenheight']; + $label .= '
'.$langs->trans("CurrentUserLanguage").': '.dol_string_nohtmltag(($s ? $s.' ' : '').$langs->getDefaultLang()); + $label .= '
'.$langs->trans("Browser").': '.dol_string_nohtmltag($conf->browser->name.($conf->browser->version ? ' '.$conf->browser->version : '').' ('.$_SERVER['HTTP_USER_AGENT'].')'); + $label .= '
'.$langs->trans("Layout").': '.dol_string_nohtmltag($conf->browser->layout); + $label .= '
'.$langs->trans("Screen").': '.dol_string_nohtmltag($_SESSION['dol_screenwidth'].' x '.$_SESSION['dol_screenheight']); if ($conf->browser->layout == 'phone') { $label .= '
'.$langs->trans("Phone").': '.$langs->trans("Yes"); } if (!empty($_SESSION["disablemodules"])) { - $label .= '
'.$langs->trans("DisabledModules").':
'.join(', ', explode(',', $_SESSION["disablemodules"])); + $label .= '
'.$langs->trans("DisabledModules").':
'.dol_string_nohtmltag(join(', ', explode(',', $_SESSION["disablemodules"]))); } } if ($infologin < 0) { @@ -2508,12 +2509,12 @@ class User extends CommonObject } if ($withpictoimg > -2 && $withpictoimg != 2) { if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { - $result .= ''; + $result .= ''; } if ($mode == 'login') { - $result .= dol_trunc($this->login, $maxlen); + $result .= dol_string_nohtmltag(dol_trunc($this->login, $maxlen)); } else { - $result .= $this->getFullName($langs, '', ($mode == 'firstelselast' ? 3 : ($mode == 'firstname' ? 2 : -1)), $maxlen); + $result .= dol_string_nohtmltag($this->getFullName($langs, '', ($mode == 'firstelselast' ? 3 : ($mode == 'firstname' ? 2 : -1)), $maxlen)); } if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $result .= ''; diff --git a/htdocs/user/home.php b/htdocs/user/home.php index 4d215685f53..e294be6a219 100644 --- a/htdocs/user/home.php +++ b/htdocs/user/home.php @@ -128,7 +128,7 @@ if ($resql) print '
'; - if ($object->particulier || $private) - { + print '
'; + if ($object->particulier || $private) { print ''.$langs->trans('ThirdPartyName').' / '.$langs->trans('LastName', 'name').''; } else { print ''.$form->editfieldkey('ThirdPartyName', 'name', '', $object, 0).''; @@ -2021,7 +2020,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) // Country print '
'.$form->editfieldkey('Country', 'selectcounty_id', '', $object, 0).''; print img_picto('', 'globe-americas', 'class="paddingrightonly"'); - print $form->select_country((GETPOSTISSET('country_id') ? GETPOST('country_id') : $object->country_id), 'country_id', '', 0, 'minwidth300 widthcentpercentminusx'); + print $form->select_country((GETPOSTISSET('country_id') ? GETPOST('country_id') : $object->country_id), 'country_id', '', 0, 'minwidth300 maxwidth500 widthcentpercentminusx'); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); print '
'.$form->editfieldkey('EMail', 'email', GETPOST('email', 'alpha'), $object, 0, 'string', '', (!empty($conf->global->SOCIETE_EMAIL_MANDATORY))).''.img_picto('', 'object_email').'
'.img_picto('', 'object_email').'
'.$form->editfieldkey('Web', 'url', GETPOST('url', 'alpha'), $object, 0).''.img_picto('', 'globe').'
'.img_picto('', 'globe').'
'.$langs->trans('Prefix').''.$object->prefix_comm.'
'.$langs->trans('Prefix').''.dol_escape_htmltag($object->prefix_comm).'
'; - print $langs->trans('CustomerCode').''; - print $object->code_client; + print $langs->trans('CustomerCode'); + print ''; + print showValueWithClipboardCPButton(dol_escape_htmltag($object->code_client)); + print '
'; print $langs->trans('SupplierCode').''; - print $object->code_fournisseur; + print showValueWithClipboardCPButton(dol_escape_htmltag($object->code_fournisseur)); $tmpcheck = $object->check_codefournisseur(); if ($tmpcheck != 0 && $tmpcheck != -5) { print ' ('.$langs->trans("WrongSupplierCode").')'; @@ -2451,7 +2453,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) if (!empty($conf->barcode->enabled)) { print '
'; - print $langs->trans('Gencod').''.dol_escape_htmltag($object->barcode); + print $langs->trans('Gencod').''.showValueWithClipboardCPButton(dol_escape_htmltag($object->barcode)); print '
'.$idprof.''; $key = 'idprof'.$i; - print $object->$key; + print showValueWithClipboardCPButton(dol_escape_htmltag($object->$key)); if ($object->$key) { if ($object->id_prof_check($i, $object) > 0) print '   '.$object->id_prof_url($i, $object); @@ -2935,7 +2937,6 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php'; } } - // End of page llxFooter(); $db->close(); diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index 81a1c167a02..3e8a6c91f92 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -1068,7 +1068,7 @@ class Thirdparties extends DolibarrApi /** * Return list of invoices qualified to be corrected by a credit note. * Invoices matching the following rules are returned - * (validated + payment on process) or classified (payed completely or payed partialy) + not already replaced + not already a credit note + * (validated + payment on process) or classified (paid completely or paid partialy) + not already replaced + not already a credit note * * @param int $id Id of thirdparty * diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index d7ae96cde94..2553179acb8 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -93,6 +93,7 @@ $search_categ_cus = trim(GETPOST("search_categ_cus", 'int')); $search_categ_sup = trim(GETPOST("search_categ_sup", 'int')); $search_country = GETPOST("search_country", 'intcomma'); $search_type_thirdparty = GETPOST("search_type_thirdparty", 'int'); +$search_price_level = GETPOST('search_prive_level', 'int'); $search_staff = GETPOST("search_staff", 'int'); $search_status = GETPOST("search_status", 'int'); $search_type = GETPOST('search_type', 'alpha'); @@ -188,8 +189,8 @@ $arrayfields = array( 's.code_compta'=>array('label'=>"CustomerAccountancyCodeShort", 'position'=>13, 'checked'=>$checkedcustomeraccountcode), 's.code_compta_fournisseur'=>array('label'=>"SupplierAccountancyCodeShort", 'position'=>14, 'checked'=>$checkedsupplieraccountcode, 'enabled'=>(!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled))), 's.address'=>array('label'=>"Address", 'position'=>19, 'checked'=>0), - 's.town'=>array('label'=>"Town", 'position'=>20, 'checked'=>0), - 's.zip'=>array('label'=>"Zip", 'position'=>21, 'checked'=>1), + 's.zip'=>array('label'=>"Zip", 'position'=>20, 'checked'=>1), + 's.town'=>array('label'=>"Town", 'position'=>21, 'checked'=>0), 'state.nom'=>array('label'=>"State", 'position'=>22, 'checked'=>0), 'region.nom'=>array('label'=>"Region", 'position'=>23, 'checked'=>0), 'country.code_iso'=>array('label'=>"Country", 'position'=>24, 'checked'=>0), @@ -198,7 +199,7 @@ $arrayfields = array( 's.phone'=>array('label'=>"Phone", 'position'=>27, 'checked'=>1), 's.fax'=>array('label'=>"Fax", 'position'=>28, 'checked'=>0), 'typent.code'=>array('label'=>"ThirdPartyType", 'position'=>29, 'checked'=>$checkedtypetiers), - 'staff.code'=>array('label'=>"Staff", 'position'=>30, 'checked'=>0), + 'staff.code'=>array('label'=>"Staff", 'position'=>31, 'checked'=>0), 's.siren'=>array('label'=>"ProfId1Short", 'position'=>40, 'checked'=>$checkedprofid1), 's.siret'=>array('label'=>"ProfId2Short", 'position'=>41, 'checked'=>$checkedprofid2), 's.ape'=>array('label'=>"ProfId3Short", 'position'=>42, 'checked'=>$checkedprofid3), @@ -215,6 +216,11 @@ $arrayfields = array( 's.status'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000), 's.import_key'=>array('label'=>"ImportId", 'checked'=>0, 'position'=>1100), ); +if (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) +{ + $arrayfields['s.price_level'] =array('label'=>"PriceLevel", 'position'=>30, 'checked'=>0); +} + // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; @@ -308,6 +314,7 @@ if (empty($reshook)) $search_idprof6 = ''; $search_vat = ''; $search_type = ''; + $search_prive_level = ''; $search_type_thirdparty = ''; $search_staff = ''; $search_status = -1; @@ -395,7 +402,7 @@ $sql .= " s.entity,"; $sql .= " st.libelle as stcomm, st.picto as stcomm_picto, s.fk_stcomm as stcomm_id, s.fk_prospectlevel, s.prefix_comm, s.client, s.fournisseur, s.canvas, s.status as status,"; $sql .= " s.email, s.phone, s.fax, s.url, s.siren as idprof1, s.siret as idprof2, s.ape as idprof3, s.idprof4 as idprof4, s.idprof5 as idprof5, s.idprof6 as idprof6, s.tva_intra, s.fk_pays,"; $sql .= " s.tms as date_update, s.datec as date_creation,"; -$sql .= " s.code_compta, s.code_compta_fournisseur, s.parent as fk_parent,"; +$sql .= " s.code_compta, s.code_compta_fournisseur, s.parent as fk_parent,s.price_level,"; $sql .= " s2.nom as name2,"; $sql .= " typent.code as typent_code,"; $sql .= " staff.code as staff_code,"; @@ -429,9 +436,11 @@ if (!empty($search_categ_sup)) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_f $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."c_stcomm as st ON s.fk_stcomm = st.id"; // We'll need this table joined to the select in order to filter by sale if ($search_sale == -2) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc = s.rowid"; -elseif ($search_sale || (!$user->rights->societe->client->voir && !$socid)) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; +//elseif ($search_sale || (empty($user->rights->societe->client->voir) && (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || empty($user->rights->societe->client->readallthirdparties_advance)) && !$socid)) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; +elseif ($search_sale || (empty($user->rights->societe->client->voir) && !$socid)) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= " WHERE s.entity IN (".getEntity('societe').")"; -if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; +//if (empty($user->rights->societe->client->voir) && (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || empty($user->rights->societe->client->readallthirdparties_advance)) && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; +if (empty($user->rights->societe->client->voir) && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; if ($search_sale && $search_sale != -2) $sql .= " AND s.rowid = sc.fk_soc"; // Join for the needed table to filter by sale if (!$user->rights->fournisseur->lire) $sql .= " AND (s.fournisseur <> 1 OR s.client <> 0)"; // client=0, fournisseur=0 must be visible if ($search_sale == -2) $sql .= " AND sc.fk_user IS NULL"; @@ -475,6 +484,7 @@ if ($search_type > 0 && in_array($search_type, array('4'))) $sql .= " AN if ($search_type == '0') $sql .= " AND s.client = 0 AND s.fournisseur = 0"; if ($search_status != '' && $search_status >= 0) $sql .= natural_search("s.status", $search_status, 2); if (!empty($conf->barcode->enabled) && $search_barcode) $sql .= natural_search("s.barcode", $search_barcode); +if ($search_prive_level && $search_prive_level != '-1') $sql .= natural_search("s.price_level", $search_prive_level, 2); if ($search_type_thirdparty && $search_type_thirdparty != '-1') $sql .= natural_search("s.fk_typent", $search_type_thirdparty, 2); if (!empty($search_staff) && $search_staff != '-1') $sql .= natural_search("s.fk_effectif", $search_staff, 2); if ($search_level) $sql .= natural_search("s.fk_prospectlevel", join(',', $search_level), 3); @@ -571,6 +581,7 @@ if ($search_idprof4 != '') $param .= '&search_idprof4='.urlencode($search_idprof if ($search_idprof5 != '') $param .= '&search_idprof5='.urlencode($search_idprof5); if ($search_idprof6 != '') $param .= '&search_idprof6='.urlencode($search_idprof6); if ($search_vat != '') $param .= '&search_vat='.urlencode($search_vat); +if ($search_prive_level != '') $param .= '&search_prive_level='.urlencode($search_prive_level); if ($search_type_thirdparty != '') $param .= '&search_type_thirdparty='.urlencode($search_type_thirdparty); if ($search_type != '') $param .= '&search_type='.urlencode($search_type); if (is_array($search_level) && count($search_level)) foreach ($search_level as $slevel) $param .= '&search_level[]='.urlencode($slevel); @@ -779,13 +790,6 @@ if (!empty($arrayfields['s.address']['checked'])) print ''; print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''.$obj->address.'".$obj->town."".$obj->zip."".$obj->town."'.$obj->price_level."'; + print ''; if ($companystatic->fk_parent > 0) { $companyparent->fetch($companystatic->fk_parent); diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index 06d0deb8ba3..8956a80d0d8 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -6,7 +6,7 @@ * Copyright (C) 2013 Peter Fontaine * Copyright (C) 2015-2016 Marcos García * Copyright (C) 2017 Ferran Marcet - * Copyright (C) 2018 ptibogxiv + * Copyright (C) 2018 -2021Thibault FOUCART * * 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 @@ -957,12 +957,16 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' try { if (empty($stripeacc)) { // If the Stripe connect account not set, we use common API usage - $paymentmethodobjs = \Stripe\PaymentMethod::all(array("customer" => $customerstripe->id, "type" => "card")); + $paymentmethodobjsA = \Stripe\PaymentMethod::all(array("customer" => $customerstripe->id, "type" => "card")); + $paymentmethodobjsB = \Stripe\PaymentMethod::all(array("customer" => $customerstripe->id, "type" => "sepa_debit")); } else { - $paymentmethodobjs = \Stripe\PaymentMethod::all(array("customer" => $customerstripe->id, "type" => "card"), array("stripe_account" => $stripeacc)); + $paymentmethodobjsA = \Stripe\PaymentMethod::all(array("customer" => $customerstripe->id, "type" => "card"), array("stripe_account" => $stripeacc)); + $paymentmethodobjsB = \Stripe\PaymentMethod::all(array("customer" => $customerstripe->id, "type" => "sepa_debit"), array("stripe_account" => $stripeacc)); } - $listofsources = $paymentmethodobjs->data; + if ($paymentmethodobjsA->data != null && $paymentmethodobjsB->data != null) { $listofsources = array_merge((array) $paymentmethodobjsA->data, (array) $paymentmethodobjsB->data); + } elseif ($paymentmethodobjsB->data != null) { $listofsources = $paymentmethodobjsB->data; } + else { $listofsources = $paymentmethodobjsA->data; } } catch (Exception $e) { $error++; @@ -1181,7 +1185,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print getCountry($src->card->country, 1); } else print img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; } elseif ($src->object == 'source' && $src->type == 'sepa_debit') { - print 'SEPA debit'; + print ''.$src->billing_details->name.'
....'.$src->sepa_debit->last4; print '
'; if ($src->sepa_debit->country) { $img = picto_from_langcode($src->sepa_debit->country); @@ -1198,7 +1202,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print getCountry($src->card->country, 1); } else print img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; } elseif ($src->object == 'payment_method' && $src->type == 'sepa_debit') { - print 'SEPA debit'; + print ''.$src->billing_details->name.'
....'.$src->sepa_debit->last4; print '
'; if ($src->sepa_debit->country) { $img = picto_from_langcode($src->sepa_debit->country); diff --git a/htdocs/stripe/admin/stripe.php b/htdocs/stripe/admin/stripe.php index c304a00ce3f..6a52b57268b 100644 --- a/htdocs/stripe/admin/stripe.php +++ b/htdocs/stripe/admin/stripe.php @@ -2,7 +2,7 @@ /* Copyright (C) 2017 Alexandre Spangaro * Copyright (C) 2017 Olivier Geffroy * Copyright (C) 2017 Saasprov - * Copyright (C) 2018-2019 Thibault FOUCART + * Copyright (C) 2018-2021 Thibault FOUCART * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -387,6 +387,21 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // TODO Not used by current code print '
'; + print $langs->trans("STRIPE_BANCONTACT").''; + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('STRIPE_BANCONTACT'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("STRIPE_BANCONTACT", $arrval, $conf->global->STRIPE_BANCONTACT); + } + print '   '.$langs->trans("ExampleOnlyForBECustomers").''; + print '
'; + print $langs->trans("STRIPE_GIROPAY").''; + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('STRIPE_GIROPAY'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("STRIPE_GIROPAY", $arrval, $conf->global->STRIPE_GIROPAY); + } + print '   '.$langs->trans("ExampleOnlyForDECustomers").''; + print '
'; + print $langs->trans("STRIPE_SOFORT").''; + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('STRIPE_SOFORT'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("STRIPE_SOFORT", $arrval, $conf->global->STRIPE_SOFORT); + } + print '   '.$langs->trans("ExampleOnlyForATBEDEITNLESCustomers").''; + print '
'.$langs->trans("DateCreation").''; - print dol_print_date($object->datec, 'dayhour'); + print dol_print_date($object->datec, 'dayhour', 'tzuser'); print ' - '.$langs->trans("TimeElapsedSince").': '.convertSecondToTime(roundUpToNextMultiple($now - $object->datec, 60)).''; print '
'.$langs->trans("TicketReadOn").''; if (!empty($object->date_read)) { - print dol_print_date($object->date_read, 'dayhour'); + print dol_print_date($object->date_read, 'dayhour', 'tzuser'); print ' - '.$langs->trans("TicketTimeToRead").': '.convertSecondToTime(roundUpToNextMultiple($object->date_read - $object->datec, 60)).''; print ' - '.$langs->trans("TimeElapsedSince").': '.convertSecondToTime(roundUpToNextMultiple($now - $object->date_read, 60)).''; } @@ -953,7 +954,7 @@ elseif (empty($action) || $action == 'view' || $action == 'addlink' || $action = // Close date print '
'.$langs->trans("TicketCloseOn").''; if (!empty($object->date_close)) { - print dol_print_date($object->date_close, 'dayhour'); + print dol_print_date($object->date_close, 'dayhour', 'tzuser'); } print '
'; print ''; print ''; - print ''; + print ''."\n"; $i = 0; while ($i < $num && $i < $max) diff --git a/htdocs/user/list.php b/htdocs/user/list.php index 04921893b6f..1f471cd3ad9 100644 --- a/htdocs/user/list.php +++ b/htdocs/user/list.php @@ -309,19 +309,22 @@ $sql .= " u.salary, u.datelastlogin, u.datepreviouslogin,"; $sql .= " u.ldap_sid, u.statut, u.entity,"; $sql .= " u.tms as date_update, u.datec as date_creation,"; $sql .= " u2.rowid as id2, u2.login as login2, u2.firstname as firstname2, u2.lastname as lastname2, u2.admin as admin2, u2.fk_soc as fk_soc2, u2.office_phone as ofice_phone2, u2.user_mobile as user_mobile2, u2.email as email2, u2.gender as gender2, u2.photo as photo2, u2.entity as entity2, u2.statut as statut2,"; -$sql .= " s.nom as name, s.canvas"; +$sql .= " s.nom as name, s.canvas,"; // Add fields from extrafields if (!empty($extrafields->attributes[$object->table_element]['label'])) { - foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : ''); + foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { + $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.' as options_'.$key.', ' : ''); + } } // Add fields from hooks $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook $sql .= preg_replace('/^,/', '', $hookmanager->resPrint); $sql = preg_replace('/,\s*$/', '', $sql); -$sql .= $hookmanager->resPrint; $sql .= " FROM ".MAIN_DB_PREFIX."user as u"; -if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (u.rowid = ef.fk_object)"; +if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (u.rowid = ef.fk_object)"; +} $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON u.fk_soc = s.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u2 ON u.fk_user = u2.rowid"; if (!empty($search_categ) || !empty($catid)) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_user as cu ON u.rowid = cu.fk_user"; // We'll need this table joined to the select in order to filter by categ diff --git a/htdocs/user/perms.php b/htdocs/user/perms.php index b058bae9743..68238b63c29 100644 --- a/htdocs/user/perms.php +++ b/htdocs/user/perms.php @@ -325,8 +325,8 @@ if ($result) // TODO Define familyposition $family = $modules[$obj->module]->family_position; $familyposition = 0; - $sqlupdate = 'UPDATE '.MAIN_DB_PREFIX."rights_def SET module_position = ".$modules[$obj->module]->module_position.","; - $sqlupdate .= " family_position = ".$familyposition; + $sqlupdate = 'UPDATE '.MAIN_DB_PREFIX."rights_def SET module_position = ".((int) $modules[$obj->module]->module_position).","; + $sqlupdate .= " family_position = ".((int) $familyposition); $sqlupdate .= " WHERE module_position = 0 AND module = '".$db->escape($obj->module)."'"; $db->query($sqlupdate); } @@ -438,9 +438,16 @@ if ($result) print ''; } - // Label - $permlabel = ($conf->global->MAIN_USE_ADVANCED_PERMS && ($langs->trans("PermissionAdvanced".$obj->id) != ("PermissionAdvanced".$obj->id)) ? $langs->trans("PermissionAdvanced".$obj->id) : (($langs->trans("Permission".$obj->id) != ("Permission".$obj->id)) ? $langs->trans("Permission".$obj->id) : $langs->trans($obj->label))); - print ''; + // Label of permission + $permlabel = (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ($langs->trans("PermissionAdvanced".$obj->id) != ("PermissionAdvanced".$obj->id)) ? $langs->trans("PermissionAdvanced".$obj->id) : (($langs->trans("Permission".$obj->id) != ("Permission".$obj->id)) ? $langs->trans("Permission".$obj->id) : $langs->trans($obj->label))); + print ''; // Permission id if ($user->admin) print ''; diff --git a/htdocs/variants/combinations.php b/htdocs/variants/combinations.php index 24da596f3c2..933d379e48a 100644 --- a/htdocs/variants/combinations.php +++ b/htdocs/variants/combinations.php @@ -107,7 +107,9 @@ if (($action == 'add' || $action == 'create') && empty($massaction) && !GETPOST( $features = $_SESSION['addvariant_'.$object->id]; if (!$features) { - setEventMessages($langs->trans('ErrorFieldsRequired'), null, 'errors'); + if ($action == 'create') { + setEventMessages($langs->trans('ErrorFieldsRequired'), null, 'errors'); + } } else { $reference = trim($reference); if (empty($reference)) { @@ -763,11 +765,11 @@ if (!empty($id) || !empty($ref)) print '
'; - print ''.$langs->trans('NewProductCombination').''; // NewVariant + print ''.$langs->trans('NewProductCombination').''; // NewVariant if ($productCombinations) { - print ''.$langs->trans('PropagateVariant').''; + print ''.$langs->trans('PropagateVariant').''; } print '
'; diff --git a/htdocs/website/class/website.class.php b/htdocs/website/class/website.class.php index 42b39e7e902..34cc78e9a05 100644 --- a/htdocs/website/class/website.class.php +++ b/htdocs/website/class/website.class.php @@ -757,7 +757,7 @@ class Website extends CommonObject // Restore id of home page $object->fk_default_home = $newidforhome; $res = $object->update($user); - if (!$res > 0) + if (!($res > 0)) { $error++; setEventMessages($object->error, $object->errors, 'errors'); @@ -1300,7 +1300,7 @@ class Website extends CommonObject $object = $this; if (empty($object->ref)) { - $this->error = 'Function importWebSite called on object not loaded (object->ref is empty)'; + $this->error = 'Function rebuildWebSiteFiles called on object not loaded (object->ref is empty)'; return -1; } @@ -1316,6 +1316,7 @@ class Website extends CommonObject $num = $this->db->num_rows($resql); + // Loop on each container/page $i = 0; while ($i < $num) { $obj = $this->db->fetch_object($resql); @@ -1333,13 +1334,15 @@ class Website extends CommonObject $error++; } - // Regenerate alternative aliases pages - if (is_array($aliasesarray)) - { - foreach ($aliasesarray as $aliasshortcuttocreate) - { - if (trim($aliasshortcuttocreate)) - { + // Add main alias to list of alternative aliases + if (!empty($objectpagestatic->pageurl) && !in_array($objectpagestatic->pageurl, $aliasesarray)) { + $aliasesarray[] = $objectpagestatic->pageurl; + } + + // Regenerate all aliases pages (pages with a natural name) + if (is_array($aliasesarray)) { + foreach ($aliasesarray as $aliasshortcuttocreate) { + if (trim($aliasshortcuttocreate)) { $filealias = $conf->website->dir_output.'/'.$object->ref.'/'.trim($aliasshortcuttocreate).'.php'; $result = dolSavePageAlias($filealias, $object, $objectpagestatic); if (!$result) { diff --git a/htdocs/website/class/websitepage.class.php b/htdocs/website/class/websitepage.class.php index 30961013806..bacc4664791 100644 --- a/htdocs/website/class/websitepage.class.php +++ b/htdocs/website/class/websitepage.class.php @@ -161,7 +161,7 @@ class WebsitePage extends CommonObject //'status' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'index'=>true, 'position'=>1000), 'fk_website' =>array('type'=>'integer', 'label'=>'WebsiteId', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>40, 'searchall'=>0, 'foreignkey'=>'websitepage.rowid'), 'fk_page' =>array('type'=>'integer', 'label'=>'ParentPageId', 'enabled'=>1, 'visible'=>1, 'notnull'=>-1, 'position'=>45, 'searchall'=>0, 'foreignkey'=>'website.rowid'), - 'allowed_in_frames' =>array('type'=>'integer', 'label'=>'AllowedInFrames', 'enabled'=>1, 'visible'=>-1, 'position'=>48, 'searchall'=>0), + 'allowed_in_frames' =>array('type'=>'integer', 'label'=>'AllowedInFrames', 'enabled'=>1, 'visible'=>-1, 'position'=>48, 'searchall'=>0, 'default'=>0), 'htmlheader' =>array('type'=>'text', 'label'=>'HtmlHeader', 'enabled'=>1, 'visible'=>0, 'position'=>50, 'searchall'=>0), 'content' =>array('type'=>'mediumtext', 'label'=>'Content', 'enabled'=>1, 'visible'=>0, 'position'=>51, 'searchall'=>0), 'grabbed_from' =>array('type'=>'varchar(255)', 'label'=>'GrabbedFrom', 'enabled'=>1, 'visible'=>1, 'index'=>1, 'position'=>400, 'comment'=>'URL page content was grabbed from'), @@ -400,7 +400,7 @@ class WebsitePage extends CommonObject $sql .= " t.fk_object"; $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; $sql .= ' WHERE t.fk_website = '.$websiteid; - // Manage filter + // Manage filter (same than into countAll) $sqlwhere = array(); if (count($filter) > 0) { foreach ($filter as $key => $value) { @@ -501,14 +501,27 @@ class WebsitePage extends CommonObject $sql = 'SELECT COUNT(t.rowid) as nb'; $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; $sql .= ' WHERE t.fk_website = '.$websiteid; - // Manage filter + // Manage filter (same than into fetchAll) $sqlwhere = array(); if (count($filter) > 0) { foreach ($filter as $key => $value) { - if ($key == 't.rowid' || $key == 't.fk_website') { - $sqlwhere[] = $key.'='.$value; + if ($key == 't.rowid' || $key == 't.fk_website' || $key == 'status') { + $sqlwhere[] = $key.' = '.$value; + } elseif ($key == 'type_container') { + $sqlwhere[] = $key." = '".$this->db->escape($value)."'"; } elseif ($key == 'lang' || $key == 't.lang') { - $sqlwhere[] = $key." = '".$this->db->escape(substr($value, 0, 2))."'"; + $listoflang = array(); + $foundnull = 0; + foreach (explode(',', $value) as $tmpvalue) { + if ($tmpvalue == 'null') { + $foundnull++; + continue; + } + $listoflang[] = "'".$this->db->escape(substr(str_replace("'", '', $tmpvalue), 0, 2))."'"; + } + $stringtouse = $key." IN (".join(',', $listoflang).")"; + if ($foundnull) $stringtouse = '('.$stringtouse.' OR '.$key.' IS NULL)'; + $sqlwhere[] = $stringtouse; } else { $sqlwhere[] = $key.' LIKE \'%'.$this->db->escape($value).'%\''; } diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 9aa556b9fe3..ebcf31ad2c5 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -1576,7 +1576,7 @@ if ($action == 'setashome') $object->fk_default_home = $pageid; $res = $object->update($user); - if (!$res > 0) + if (! ($res > 0)) { $error++; setEventMessages($object->error, $object->errors, 'errors'); @@ -1752,7 +1752,6 @@ if ($action == 'updatemeta') dol_mkdir($pathofwebsite); - // Now generate the master.inc.php page $result = dolSaveMasterFile($filemaster); if (!$result) setEventMessages('Failed to write file '.$filemaster, null, 'errors'); @@ -1762,6 +1761,17 @@ if ($action == 'updatemeta') { dol_syslog("We delete old alias page name=".$fileoldalias." to build a new alias page=".$filealias); dol_delete_file($fileoldalias); + + // Delete also pages into language subdirectories + if (empty($objectpage->lang) || !in_array($objectpage->lang, explode(',', $object->otherlang))) { + $dirname = dirname($fileoldalias); + $filename = basename($fileoldalias); + $sublangs = explode(',', $object->otherlang); + foreach ($sublangs as $sublang) { + $fileoldaliassub = $dirname.'/'.$sublang.'/'.$filename; + dol_delete_file($fileoldaliassub); + } + } } // Now delete the alternative alias.php pages if (!empty($objectpage->old_object->aliasalt)) @@ -1773,11 +1783,22 @@ if ($action == 'updatemeta') { dol_syslog("We delete old alt alias pages name=".trim($tmpaliasalt)); dol_delete_file($pathofwebsite.'/'.trim($tmpaliasalt).'.php'); + + // Delete also pages into language subdirectories + if (empty($objectpage->lang) || !in_array($objectpage->lang, explode(',', $object->otherlang))) { + $dirname = dirname($pathofwebsite.'/'.trim($tmpaliasalt).'.php'); + $filename = basename($pathofwebsite.'/'.trim($tmpaliasalt).'.php'); + $sublangs = explode(',', $object->otherlang); + foreach ($sublangs as $sublang) { + $fileoldaliassub = $dirname.'/'.$sublang.'/'.$filename; + dol_delete_file($fileoldaliassub); + } + } } } } - // Save page alias + // Save page main alias $result = dolSavePageAlias($filealias, $object, $objectpage); if (!$result) setEventMessages('Failed to write file '.$filealias, null, 'errors'); // Save alt aliases @@ -2025,19 +2046,28 @@ if (($action == 'updatesource' || $action == 'updatecontent' || $action == 'conf dol_mkdir($pathofwebsite); - // Now generate the master.inc.php page $result = dolSaveMasterFile($filemaster); if (!$result) setEventMessages('Failed to write the master file file '.$filemaster, null, 'errors'); - - // Now generate the alias.php page - if (!empty($fileoldalias)) + // Now delete the old alias.php page if we removed one + /*if (!empty($fileoldalias)) { dol_syslog("We regenerate alias page new name=".$filealias.", old name=".$fileoldalias); dol_delete_file($fileoldalias); - } + + // Delete also pages into language subdirectories + if (empty($objectpage->lang) || !in_array($objectpage->lang, explode(',', $object->otherlang))) { + $dirname = dirname($fileoldalias); + $filename = basename($fileoldalias); + $sublangs = explode(',', $object->otherlang); + foreach ($sublangs as $sublang) { + $fileoldaliassub = $dirname.'/'.$sublang.'/'.$filename; + dol_delete_file($fileoldaliassub); + } + } + }*/ // Save page alias $result = dolSavePageAlias($filealias, $object, $objectpage); @@ -2429,15 +2459,17 @@ if (!GETPOST('hide_websitemenu')) //print ''; print ''; + print ''; print ''; + // Regenerate all pages + print 'ref.'" class="button bordertransp"'.$disabled.' title="'.dol_escape_htmltag($langs->trans("RegenerateWebsiteContent")).'">'; + print '   '; print 'ref.'" class="button bordertransp"'.$disabled.' title="'.dol_escape_htmltag($langs->trans("ReplaceWebsiteContent")).'">'; - - print 'ref.'" class="button bordertransp"'.$disabled.' title="'.dol_escape_htmltag($langs->trans("RegenerateWebsiteContent")).'">'; } print ''; diff --git a/htdocs/workstation/class/workstationresource.class.php b/htdocs/workstation/class/workstationresource.class.php index 21398460eca..6e6860f2230 100644 --- a/htdocs/workstation/class/workstationresource.class.php +++ b/htdocs/workstation/class/workstationresource.class.php @@ -22,10 +22,10 @@ * \brief This file is a CRUD class file for WorkstationResource (Create/Read/Update/Delete) */ -/** - * Class for WorkstationResource - */ +/** + * Class to link resource with Workstations + */ class WorkstationResource extends CommonObject { /** @var string $table_element Table name in SQL */ @@ -34,17 +34,34 @@ class WorkstationResource extends CommonObject /** @var string $element Name of the element (tip for better integration in Dolibarr: this value should be the reflection of the class name with ucfirst() function) */ public $element = 'workstationresource'; + /** + * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + */ public $fields = array( 'fk_workstation' => array ('type' => 'integer'), 'fk_resource' => array ('type' => 'integer') ); + /** + * @var int ID of workstation + */ + public $fk_workstation; + + /** + * @var int ID of dolresource + */ + public $fk_resource; + + /** * WorkstationResource constructor. + * * @param DoliDB $db Database connector */ public function __construct($db) { + global $langs; + $this->db = $db; // Unset fields that are disabled @@ -74,8 +91,9 @@ class WorkstationResource extends CommonObject /** * Function used to get an array with all resources linked to a workstation - * @param int $fk_workstation id of workstation we need to get linked resources - * @return array + * + * @param int $fk_workstation Id of workstation we need to get linked resources + * @return array Array of record */ static public function getAllResourcesOfWorkstation($fk_workstation) { @@ -86,8 +104,9 @@ class WorkstationResource extends CommonObject /** * Function used to remove all resources linked to a workstation - * @param int $fk_workstation id of workstation we need to remove linked resources - * @return int + * + * @param int $fk_workstation Id of workstation we need to remove linked resources + * @return int <0 if KO, 0 if nothing done, >0 if OK and something done */ static public function deleteAllResourcesOfWorkstation($fk_workstation) { diff --git a/htdocs/workstation/class/workstationusergroup.class.php b/htdocs/workstation/class/workstationusergroup.class.php index b45d24c7c60..920fb896bdc 100644 --- a/htdocs/workstation/class/workstationusergroup.class.php +++ b/htdocs/workstation/class/workstationusergroup.class.php @@ -23,9 +23,8 @@ */ /** - * Class for WorkstationUserGroup + * Class to link User groups and Workstations */ - class WorkstationUserGroup extends CommonObject { /** @var string $table_element Table name in SQL */ @@ -34,17 +33,34 @@ class WorkstationUserGroup extends CommonObject /** @var string $element Name of the element (tip for better integration in Dolibarr: this value should be the reflection of the class name with ucfirst() function) */ public $element = 'workstationusergroup'; + /** + * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + */ public $fields = array( 'fk_workstation' => array ('type' => 'integer'), 'fk_usergroup' => array ('type' => 'integer') ); + /** + * @var int ID of workstation + */ + public $fk_workstation; + + /** + * @var int ID of user group + */ + public $fk_usergroup; + + /** * WorkstationUserGroup constructor. + * * @param DoliDB $db Database connector */ public function __construct($db) { + global $langs; + $this->db = $db; // Unset fields that are disabled @@ -74,24 +90,28 @@ class WorkstationUserGroup extends CommonObject /** * Function used to get an array with all usergroups linked to a workstation + * * @param int $fk_workstation id of workstation we need to get linked usergroups - * @return array + * @return array Array of record */ static public function getAllGroupsOfWorkstation($fk_workstation) { global $db; + $obj = new self($db); return parent::getAllItemsLinkedByObjectID($fk_workstation, 'fk_usergroup', 'fk_workstation', $obj->table_element); } /** * Function used to remove all usergroups linked to a workstation - * @param int $fk_workstation id of workstation we need to remove linked usergroups - * @return int + * + * @param int $fk_workstation Id of workstation we need to remove linked usergroups + * @return int <0 if KO, 0 if nothing done, >0 if OK and something done */ static public function deleteAllGroupsOfWorkstation($fk_workstation) { global $db; + $obj = new self($db); return parent::deleteAllItemsLinkedByObjectID($fk_workstation, 'fk_workstation', $obj->table_element); } diff --git a/test/phpunit/CodingPhpTest.php b/test/phpunit/CodingPhpTest.php index e993428adf0..cf58c298206 100644 --- a/test/phpunit/CodingPhpTest.php +++ b/test/phpunit/CodingPhpTest.php @@ -376,7 +376,18 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase break; } $this->assertTrue($ok, 'Found a declaration @var array() instead of @var array in file '.$file['relativename'].'.'); - } + + + // Test we don't have CURDATE() + $ok=true; + $matches=array(); + preg_match_all('/CURDATE\(\)/', $filecontent, $matches, PREG_SET_ORDER); + foreach ($matches as $key => $val) { + $ok=false; + break; + } + $this->assertTrue($ok, 'Found a CURDATE\(\) into code. Do not use this SQL method in file '.$file['relativename'].'. You must use the PHP function dol_now() instead.'); + } return; } diff --git a/test/phpunit/ExportTest.php b/test/phpunit/ExportTest.php index a3386c7aef5..4051deb125b 100644 --- a/test/phpunit/ExportTest.php +++ b/test/phpunit/ExportTest.php @@ -279,15 +279,14 @@ class ExportTest extends PHPUnit\Framework\TestCase $expectedresult=1; $this->assertEquals($expectedresult, $result, 'Error in TSV export'); - $model='excel2007new'; + $model='excel2007'; // Build export file /* ko on php 7.4 on travis (zip not available) */ print "Process build_file for model = ".$model."\n"; $result=$objexport->build_file($user, $model, $datatoexport, $array_selected, array(), $sql); $expectedresult=1; - $this->assertEquals($expectedresult, $result, 'Error in Excel2007new export'); - + $this->assertEquals($expectedresult, $result, 'Error in Excel2007 export'); return true; } diff --git a/test/phpunit/FactureTest.php b/test/phpunit/FactureTest.php index 506013599bc..700507a4edf 100644 --- a/test/phpunit/FactureTest.php +++ b/test/phpunit/FactureTest.php @@ -242,7 +242,7 @@ class FactureTest extends PHPUnit\Framework\TestCase true, array( 'newref','oldref','id','lines','client','thirdparty','brouillon','user_author','date_creation','date_validation','datem','date_modification', - 'ref','statut','paye','specimen','ref','actiontypecode','actionmsg2','actionmsg','mode_reglement','cond_reglement', + 'ref','statut','status','paye','specimen','ref','actiontypecode','actionmsg2','actionmsg','mode_reglement','cond_reglement', 'cond_reglement_doc', 'modelpdf', 'multicurrency_total_ht','multicurrency_total_tva', 'multicurrency_total_ttc','fk_multicurrency','multicurrency_code','multicurrency_tx', 'retained_warranty' ,'retained_warranty_date_limit', 'retained_warranty_fk_cond_reglement', 'specimen', 'situation_cycle_ref', 'situation_counter', 'situation_final', diff --git a/test/phpunit/SecurityTest.php b/test/phpunit/SecurityTest.php index 8709c66f15d..fb9dbe5100e 100644 --- a/test/phpunit/SecurityTest.php +++ b/test/phpunit/SecurityTest.php @@ -186,7 +186,11 @@ class SecurityTest extends PHPUnit\Framework\TestCase $_SERVER["PHP_SELF"]='/DIR WITH SPACE/htdocs/admin/index.php?mainmenu=home&leftmenu=setup&username=weservices'; $result=testSqlAndScriptInject($_SERVER["PHP_SELF"], 2); - $this->assertEquals($expectedresult, $result, 'Error on testSqlAndScriptInject 1a'); + $this->assertEquals($expectedresult, $result, 'Error on testSqlAndScriptInject expected 0a'); + + $test = 'This is a < inside string with < and > also and tag like before the >'; + $result=testSqlAndScriptInject($test, 0); + $this->assertEquals($expectedresult, $result, 'Error on testSqlAndScriptInject expected 0b'); // Should detect XSS $expectedresult=1; @@ -275,6 +279,10 @@ class SecurityTest extends PHPUnit\Framework\TestCase $test="onerror=alert(1)"; $result=testSqlAndScriptInject($test, 0); $this->assertGreaterThanOrEqual($expectedresult, $result, 'Error on testSqlAndScriptInject jjj'); + + $test="rror=alert(document.location)"; + $result=testSqlAndScriptInject($test, 0); + $this->assertGreaterThanOrEqual($expectedresult, $result, 'Error on testSqlAndScriptInject kkk'); } /** @@ -299,7 +307,9 @@ class SecurityTest extends PHPUnit\Framework\TestCase $_GET["param5"]="a_1-b"; $_POST["param6"]="">objnotdefined\''; $_POST["param11"]=' Name '; @@ -363,10 +373,18 @@ class SecurityTest extends PHPUnit\Framework\TestCase print __METHOD__." result=".$result."\n"; $this->assertEquals('"c:\this is a path~1\aaan" abcdef', $result); - // With alphanohtml, we must convert the html entities like n - $result=GETPOST("param8", 'alphanohtml'); + // With alphanohtml, we must convert the html entities like n and disable all entities + $result=GETPOST("param8a", 'alphanohtml'); print __METHOD__." result=".$result."\n"; - $this->assertEquals("HackerassertEquals("Hackersvg onload='console.log(123)'", $result); + + $result=GETPOST("param8b", 'alphanohtml'); + print __METHOD__." result=".$result."\n"; + $this->assertEquals('img src=x onerror=alert(document.location) t=', $result, 'Test a string with non closing html tag with alphanohtml'); + + $result=GETPOST("param8c", 'alphanohtml'); + print __METHOD__." result=".$result."\n"; + $this->assertEquals($_POST['param8c'], $result, 'Test a string with non closing html tag with alphanohtml'); $result=GETPOST("param9", 'alphanohtml'); print __METHOD__." result=".$result."\n"; @@ -574,10 +592,10 @@ class SecurityTest extends PHPUnit\Framework\TestCase $this->assertEquals(400, $tmp['http_code'], 'GET url to '.$url.' that is a local URL'); // Test we receive an error because localtest.me is not an external URL /*$url = 'localtest.me'; - $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL - print __METHOD__." url=".$url."\n"; - $this->assertEquals(400, $tmp['http_code'], 'GET url to '.$url.' that resolves to a local URL'); // Test we receive an error because localtest.me is not an external URL - */ + $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL + print __METHOD__." url=".$url."\n"; + $this->assertEquals(400, $tmp['http_code'], 'GET url to '.$url.' that resolves to a local URL'); // Test we receive an error because localtest.me is not an external URL + */ return 0; }
'.$langs->trans("LastUsersCreated", min($num, $max)).''.$langs->trans("FullList").'
 '.$permlabel.''; + print $permlabel; + if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) { + if (preg_match('/_advance$/', $obj->perms)) { + print ' ('.$langs->trans("AdvancedModeOnly").')'; + } + } + print ''.$obj->id.'