From 0598656be7037fb6b4a1fbc1c6594ade2796fa4d Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Thu, 21 Jan 2021 21:23:31 +0100 Subject: [PATCH 01/10] FIX: Accountancy - Search_not_reconciled --- htdocs/accountancy/bookkeeping/listbyaccount.php | 4 ++-- htdocs/accountancy/bookkeeping/listbysubaccount.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index 55e57b4463f..08b3530428b 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -74,7 +74,7 @@ $search_ledger_code = GETPOST('search_ledger_code', 'alpha'); $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'; @@ -512,7 +512,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 be7eacfe8c6..20860830b08 100644 --- a/htdocs/accountancy/bookkeeping/listbysubaccount.php +++ b/htdocs/accountancy/bookkeeping/listbysubaccount.php @@ -74,7 +74,7 @@ $search_ledger_code = GETPOST('search_ledger_code', 'alpha'); $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 From 77a43c51f9239e003812ee099402b76418b6bbad Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Fri, 22 Jan 2021 15:10:23 +0100 Subject: [PATCH 02/10] FIX: Accountancy - Search_not_reconciled --- htdocs/accountancy/bookkeeping/list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 9c4142daf58..882c51f40c0 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', 'alpha'); $search_lettering_code = GETPOST('search_lettering_code', 'alpha'); -$search_not_reconciled = GETPOST('search_reconciled_option', 'alpha'); +$search_not_reconciled = GETPOST('search_not_reconciled', 'alpha'); // Load variable for pagination $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION); @@ -761,7 +761,7 @@ if (!empty($arrayfields['t.lettering_code']['checked'])) { print ''; print ''; - print '
'.$langs->trans("NotReconciled").''; + print '
'.$langs->trans("NotReconciled").''; print ''; } From 89219a37a692aabc0d6079ee2579c7419d55445b Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sat, 23 Jan 2021 13:24:00 +0100 Subject: [PATCH 03/10] Fix stripe Payment method delete --- htdocs/public/stripe/ipn.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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') { From f7e637a5529cbb9ec8c3ca891d958256f0c3c806 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 23 Jan 2021 17:40:14 +0100 Subject: [PATCH 04/10] Trans --- htdocs/langs/en_US/admin.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index db54bd29cc2..19903326e70 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1874,7 +1874,7 @@ BackgroundTableLineOddColor=Background color for odd table lines BackgroundTableLineEvenColor=Background color for even table lines MinimumNoticePeriod=Minimum notice period (Your leave request must be done before this delay) NbAddedAutomatically=Number of days added to counters of users (automatically) each month -EnterAnyCode=This field contains a reference to identify line. Enter any value of your choice, but without special characters. +EnterAnyCode=This field contains a reference to identify the line. Enter any value of your choice, but without special characters. Enter0or1=Enter 0 or 1 UnicodeCurrency=Enter here between braces, list of byte number that represent the currency symbol. For example: for $, enter [36] - for brazil real R$ [82,36] - for €, enter [8364] ColorFormat=The RGB color is in HEX format, eg: FF0000 From 452aea1d8bfeef9a6a957f0dfa1cf7d2ac03ff06 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 23 Jan 2021 17:49:08 +0100 Subject: [PATCH 05/10] Fix bad test --- htdocs/accountancy/admin/index.php | 37 ++++++++++++++----- htdocs/adherents/admin/adherent.php | 2 +- htdocs/adherents/admin/adherent_emails.php | 2 +- htdocs/adherents/admin/website.php | 2 +- htdocs/admin/agenda.php | 2 +- htdocs/admin/agenda_extsites.php | 12 +++--- htdocs/admin/bank.php | 2 +- htdocs/admin/bom.php | 6 +-- htdocs/admin/chequereceipts.php | 4 +- htdocs/admin/commande.php | 14 +++---- htdocs/admin/contract.php | 2 +- htdocs/admin/delivery.php | 4 +- htdocs/admin/expensereport.php | 4 +- htdocs/admin/facture.php | 12 +++--- htdocs/admin/fichinter.php | 14 +++---- htdocs/admin/holiday.php | 2 +- htdocs/admin/mailing.php | 10 +++-- htdocs/admin/mailman.php | 2 +- htdocs/admin/mrp.php | 6 +-- htdocs/admin/payment.php | 6 +-- htdocs/admin/paymentbybanktransfer.php | 12 +++--- htdocs/admin/prelevement.php | 4 +- htdocs/admin/propal.php | 12 +++--- htdocs/admin/spip.php | 2 +- htdocs/admin/stock.php | 2 +- htdocs/admin/supplier_invoice.php | 4 +- htdocs/admin/supplier_order.php | 4 +- htdocs/admin/supplier_payment.php | 4 +- htdocs/admin/supplier_proposal.php | 8 ++-- htdocs/admin/syslog.php | 4 +- htdocs/admin/taxes.php | 10 ++--- htdocs/admin/ticket.php | 22 +++++------ htdocs/admin/ticket_public.php | 22 +++++------ htdocs/bookmarks/admin/bookmark.php | 2 +- htdocs/cashdesk/admin/cashdesk.php | 2 +- htdocs/collab/index.php | 2 +- htdocs/comm/remx.php | 2 +- htdocs/core/actions_setmoduleoptions.inc.php | 2 +- htdocs/don/admin/donation.php | 4 +- htdocs/modulebuilder/template/admin/setup.php | 15 ++++---- htdocs/paypal/admin/paypal.php | 2 +- htdocs/product/admin/product.php | 6 +-- htdocs/projet/admin/project.php | 4 +- htdocs/recruitment/admin/public_interface.php | 2 +- htdocs/recruitment/admin/setup.php | 2 +- .../recruitment/admin/setup_candidatures.php | 2 +- htdocs/societe/admin/societe.php | 18 ++++----- htdocs/takepos/admin/appearance.php | 2 +- htdocs/takepos/admin/other.php | 2 +- htdocs/takepos/admin/receipt.php | 2 +- htdocs/takepos/admin/setup.php | 4 +- htdocs/takepos/admin/terminal.php | 2 +- htdocs/website/class/website.class.php | 2 +- htdocs/website/index.php | 2 +- 54 files changed, 180 insertions(+), 156 deletions(-) diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php index 516af988334..00922f90454 100644 --- a/htdocs/accountancy/admin/index.php +++ b/htdocs/accountancy/admin/index.php @@ -103,8 +103,9 @@ 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++; + } if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); @@ -116,8 +117,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 { @@ -128,8 +131,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,8 +145,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 { @@ -152,8 +159,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 { @@ -164,8 +173,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 { @@ -176,8 +187,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 { @@ -188,8 +201,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 { @@ -200,8 +215,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 { @@ -209,9 +226,11 @@ if ($action == 'setdisablebindingonexpensereports') { } } + /* * View */ + $form = new Form($db); $title = $langs->trans('ConfigAccountingExpert'); 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/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/expensereport.php b/htdocs/admin/expensereport.php index a93f5c3c608..8a76b46049e 100644 --- a/htdocs/admin/expensereport.php +++ b/htdocs/admin/expensereport.php @@ -58,7 +58,9 @@ 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) { 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 1c96ce68780..1bf77419f34 100644 --- a/htdocs/admin/mailing.php +++ b/htdocs/admin/mailing.php @@ -51,15 +51,17 @@ if ($action == 'setvalue') $mailingdelay = GETPOST('MAILING_DELAY', '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++; // 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) { 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/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 cd0db2a1def..7d5ed1dafa8 100644 --- a/htdocs/admin/paymentbybanktransfer.php +++ b/htdocs/admin/paymentbybanktransfer.php @@ -53,7 +53,7 @@ if ($action == "set") 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++; @@ -73,29 +73,29 @@ if ($action == "set") } else $error++; $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 c7bae90b373..2871049108b 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,7 +75,7 @@ if ($action == "set") } else $error++; $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); 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/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 031b0ef102f..39a9e5ae601 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/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/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/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/remx.php b/htdocs/comm/remx.php index 57c1cf40114..e2900858c84 100644 --- a/htdocs/comm/remx.php +++ b/htdocs/comm/remx.php @@ -70,7 +70,7 @@ if ($action == 'confirm_split' && GETPOST("confirm", "alpha") == 'yes') $remid = (GETPOST("remid", 'int') ? GETPOST("remid", 'int') : 0); $discount = new DiscountAbsolute($db); $res = $discount->fetch($remid); - if (!$res > 0) + if (!($res > 0)) { $error++; setEventMessages($langs->trans("ErrorFailedToLoadDiscount"), null, 'errors'); diff --git a/htdocs/core/actions_setmoduleoptions.inc.php b/htdocs/core/actions_setmoduleoptions.inc.php index 31af34e3ad1..d662d3c85c9 100644 --- a/htdocs/core/actions_setmoduleoptions.inc.php +++ b/htdocs/core/actions_setmoduleoptions.inc.php @@ -73,7 +73,7 @@ if ($action == 'setModuleOptions') if ($param) { $res = dolibarr_set_const($db, $param, $value, 'chaine', 0, '', $conf->entity); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; } } } diff --git a/htdocs/don/admin/donation.php b/htdocs/don/admin/donation.php index 78a3d50dfcc..7b0896134e0 100644 --- a/htdocs/don/admin/donation.php +++ b/htdocs/don/admin/donation.php @@ -118,7 +118,7 @@ if ($action == 'set_DONATION_ACCOUNTINGACCOUNT') $res = dolibarr_set_const($db, "DONATION_ACCOUNTINGACCOUNT", $account, 'chaine', 0, '', $conf->entity); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; if (!$error) { @@ -134,7 +134,7 @@ if ($action == 'set_DONATION_MESSAGE') $res = dolibarr_set_const($db, "DONATION_MESSAGE", $freemessage, 'chaine', 0, '', $conf->entity); - if (!$res > 0) $error++; + if (!($res > 0)) $error++; if (!$error) { diff --git a/htdocs/modulebuilder/template/admin/setup.php b/htdocs/modulebuilder/template/admin/setup.php index c7cc61171a7..e4545390457 100644 --- a/htdocs/modulebuilder/template/admin/setup.php +++ b/htdocs/modulebuilder/template/admin/setup.php @@ -76,17 +76,18 @@ if ((float) DOL_VERSION >= 6) include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; } -if ($action == 'updateMask') -{ +if ($action == 'updateMask') { $maskconstorder = GETPOST('maskconstorder', 'alpha'); $maskorder = GETPOST('maskorder', 'alpha'); - if ($maskconstorder) $res = dolibarr_set_const($db, $maskconstorder, $maskorder, 'chaine', 0, '', $conf->entity); + if ($maskconstorder) { + $res = dolibarr_set_const($db, $maskconstorder, $maskorder, 'chaine', 0, '', $conf->entity); + if (!($res > 0)) { + $error++; + } + } - if (!$res > 0) $error++; - - if (!$error) - { + if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { setEventMessages($langs->trans("Error"), null, 'errors'); 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/product/admin/product.php b/htdocs/product/admin/product.php index 6cd727d33b8..6057b6926b7 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') { @@ -249,7 +249,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/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/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/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/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/website/class/website.class.php b/htdocs/website/class/website.class.php index 42b39e7e902..2d477ec41b9 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'); diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 9aa556b9fe3..3979dc90fbe 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'); From b4783f69d61610a50d3153fe2f1e68802e4d9f71 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 23 Jan 2021 18:13:50 +0100 Subject: [PATCH 06/10] Show if permission is an advanced permission --- htdocs/langs/en_US/admin.lang | 3 ++- htdocs/user/perms.php | 17 ++++++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 19903326e70..48a44577528 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -2089,4 +2089,5 @@ ModuleActivatedDoNotUseInProduction=A module designed for the development has be CombinationsSeparator=Separator character for product combinations SeeLinkToOnlineDocumentation=See link to online documention on top menu for examples SHOW_SUBPRODUCT_REF_IN_PDF=If the feature "%s" of module %s is used, show details of subproducts of a kit on PDF. -AskThisIDToYourBank=Contact your bank to get this ID \ No newline at end of file +AskThisIDToYourBank=Contact your bank to get this ID +AdvancedModeOnly=Permision available in Advanced permission mode only \ No newline at end of file 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 ''.$permlabel.''; + // 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 ''; + print $permlabel; + if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) { + if (preg_match('/_advance$/', $obj->perms)) { + print ' ('.$langs->trans("AdvancedModeOnly").')'; + } + } + print ''; // Permission id if ($user->admin) print ''.$obj->id.''; From c5bbaffb5083ca426678d9d89e7b2741ead6bf1f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 23 Jan 2021 19:50:04 +0100 Subject: [PATCH 07/10] Fix look and feel v13 --- htdocs/core/class/commonobject.class.php | 25 +++++++------------ htdocs/core/class/html.formticket.class.php | 2 +- .../class/recruitmentcandidature.class.php | 2 +- .../class/recruitmentjobposition.class.php | 8 +++--- htdocs/theme/eldy/global.inc.php | 4 +-- htdocs/ticket/card.php | 1 + 6 files changed, 18 insertions(+), 24 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index eb360b4a328..cc6dc21ba95 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -5912,8 +5912,7 @@ abstract class CommonObject $objectid = $this->id; - if ($computed) - { + if ($computed) { if (!preg_match('/^search_/', $keyprefix)) return ''.$langs->trans("AutomaticallyCalculated").''; else return ''; } @@ -5922,26 +5921,20 @@ abstract class CommonObject if (empty($morecss) && !empty($val['css'])) { $morecss = $val['css']; } elseif (empty($morecss)) { - if ($type == 'date') - { + if ($type == 'date') { $morecss = 'minwidth100imp'; - } elseif ($type == 'datetime' || $type == 'link') // link means an foreign key to another primary id - { + } elseif ($type == 'datetime' || $type == 'link') { // link means an foreign key to another primary id $morecss = 'minwidth200imp'; - } elseif (in_array($type, array('int', 'integer', 'price')) || preg_match('/^double(\([0-9],[0-9]\)){0,1}/', $type)) - { + } elseif (in_array($type, array('int', 'integer', 'price')) || preg_match('/^double(\([0-9],[0-9]\)){0,1}/', $type)) { $morecss = 'maxwidth75'; } elseif ($type == 'url') { $morecss = 'minwidth400'; - } elseif ($type == 'boolean') - { + } elseif ($type == 'boolean') { $morecss = ''; } else { - if (round($size) < 12) - { + if (round($size) < 12) { $morecss = 'minwidth100'; - } elseif (round($size) <= 48) - { + } elseif (round($size) <= 48) { $morecss = 'minwidth200'; } else { $morecss = 'minwidth400'; @@ -6338,13 +6331,13 @@ abstract class CommonObject if (!preg_match('/search_/', $keyprefix)) { if (!empty($param_list_array[2])) { // If the entry into $fields is set to add a create button - if ($this->fields[$key]['picto']) { + if (!empty($this->fields[$key]['picto'])) { $morecss .= ' widthcentpercentminusxx'; } else { $morecss .= ' widthcentpercentminusx'; } } else { - if ($this->fields[$key]['picto']) { + if (!empty($this->fields[$key]['picto'])) { $morecss .= ' widthcentpercentminusx'; } } diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index 60debed9f2d..d7cf03c41e0 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -408,7 +408,7 @@ class FormTicket { $formproject = new FormProjets($this->db); print ''; - print $formproject->select_projects(-1, GETPOST('projectid', 'int'), 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 0, 0, 'maxwidth500'); + print img_picto('', 'project').$formproject->select_projects(-1, GETPOST('projectid', 'int'), 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500'); print ''; } 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/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index f700dbd0e2a..ce0ecf3d31f 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -1313,11 +1313,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; } diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index d4185e7dbc6..6abb2464394 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -637,6 +637,7 @@ if (empty($reshook)) { if (GETPOSTISSET('actionbis') && $action == 'presend') $action = 'presend_addmessage'; } + /* * View */ From 0203965fbf8d07f7afb842713576f8be9594158e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 24 Jan 2021 13:04:02 +0100 Subject: [PATCH 08/10] Fix typo --- htdocs/website/class/website.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/website/class/website.class.php b/htdocs/website/class/website.class.php index 2d477ec41b9..0c90b499bed 100644 --- a/htdocs/website/class/website.class.php +++ b/htdocs/website/class/website.class.php @@ -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; } From d9908efdef7b825111026a48e15eb0d3d3525d64 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 24 Jan 2021 13:27:52 +0100 Subject: [PATCH 09/10] Code comment --- htdocs/core/lib/website2.lib.php | 18 +++++++++++------- htdocs/website/class/website.class.php | 3 ++- htdocs/website/index.php | 6 ++++-- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/htdocs/core/lib/website2.lib.php b/htdocs/core/lib/website2.lib.php index 3462212ee25..e558e4ee545 100644 --- a/htdocs/core/lib/website2.lib.php +++ b/htdocs/core/lib/website2.lib.php @@ -52,8 +52,8 @@ function dolSaveMasterFile($filemaster) } /** - * Save content of a page on disk. - * It can save file into root directory or into language subdirectory. + * Save an alias page on disk (A page that include the reference page). + * It saves file into the root directory but also into language subdirectory. * * @param string $filealias Full path of filename to generate * @param Website $object Object website @@ -82,7 +82,7 @@ function dolSavePageAlias($filealias, $object, $objectpage) @chmod($filealias, octdec($conf->global->MAIN_UMASK)); } - // Save also alias into language subdirectory if we have to + // Save also alias into language subdirectory if it is not a main language if ($objectpage->lang && in_array($objectpage->lang, explode(',', $object->otherlang))) { $dirname = dirname($filealias); $filename = basename($filealias); @@ -103,13 +103,16 @@ function dolSavePageAlias($filealias, $object, $objectpage) } } + // Save also alias into all language subdirectories if it is a main language + // TODO + return ($result ?true:false); } /** - * Save content of a page on disk. - * Page contents are always saved into root directory. + * Save content of a page on disk (page name is generally ID_of_page.php). + * Page contents are always saved into "root" directory. Only aliases pages saved with dolSavePageAlias() can be in root or language subdir. * * @param string $filetpl Full path of filename to generate * @param Website $object Object website @@ -230,10 +233,11 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage) //var_dump($filetpl);exit; $result = file_put_contents($filetpl, $tplcontent); - if (!empty($conf->global->MAIN_UMASK)) + if (!empty($conf->global->MAIN_UMASK)) { @chmod($filetpl, octdec($conf->global->MAIN_UMASK)); + } - return $result; + return $result; } diff --git a/htdocs/website/class/website.class.php b/htdocs/website/class/website.class.php index 0c90b499bed..1f2212668f7 100644 --- a/htdocs/website/class/website.class.php +++ b/htdocs/website/class/website.class.php @@ -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,7 +1334,7 @@ class Website extends CommonObject $error++; } - // Regenerate alternative aliases pages + // Regenerate aliases pages (pages with a natural name) if (is_array($aliasesarray)) { foreach ($aliasesarray as $aliasshortcuttocreate) diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 3979dc90fbe..30937b74c34 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -2429,15 +2429,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 ''; From c5cda97c197dae1187be490c8810dc2c81e9e629 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 24 Jan 2021 14:31:29 +0100 Subject: [PATCH 10/10] FIX Generation of aliases (main alias and alt alias into subdirs) --- htdocs/core/lib/website2.lib.php | 25 +++++++++++++++++++++++-- htdocs/website/class/website.class.php | 16 +++++++++------- 2 files changed, 32 insertions(+), 9 deletions(-) diff --git a/htdocs/core/lib/website2.lib.php b/htdocs/core/lib/website2.lib.php index e558e4ee545..004ac154aee 100644 --- a/htdocs/core/lib/website2.lib.php +++ b/htdocs/core/lib/website2.lib.php @@ -102,9 +102,30 @@ function dolSavePageAlias($filealias, $object, $objectpage) @chmod($filealias, octdec($conf->global->MAIN_UMASK)); } } - // Save also alias into all language subdirectories if it is a main language - // TODO + elseif (empty($objectpage->lang) || !in_array($objectpage->lang, explode(',', $object->otherlang))) { + if (empty($conf->global->WEBSITE_DISABLE_MAIN_LANGUAGE_INTO_LANGSUBDIR)) { + $dirname = dirname($filealias); + $filename = basename($filealias); + foreach (explode(',', $object->otherlang) as $sublang) { + $filealias = $dirname.'/'.$sublang.'/'.$filename; + + $aliascontent = 'id.'.tpl.php\'; '; + $aliascontent .= 'else require $dolibarr_main_data_root.\'/website/\'.$website->ref.\'/page'.$objectpage->id.'.tpl.php\';'."\n"; + $aliascontent .= '?>'."\n"; + $result = file_put_contents($filealias, $aliascontent); + if ($result === false) { + dol_syslog("Failed to write file ".$filealias, LOG_WARNING); + } + if (!empty($conf->global->MAIN_UMASK)) { + @chmod($filealias, octdec($conf->global->MAIN_UMASK)); + } + } + } + } return ($result ?true:false); } diff --git a/htdocs/website/class/website.class.php b/htdocs/website/class/website.class.php index 1f2212668f7..34cc78e9a05 100644 --- a/htdocs/website/class/website.class.php +++ b/htdocs/website/class/website.class.php @@ -1334,13 +1334,15 @@ class Website extends CommonObject $error++; } - // Regenerate aliases pages (pages with a natural name) - 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) {